awswrangler.quicksight.create_athena_dataset¶
- awswrangler.quicksight.create_athena_dataset(name: str, database: str | None = None, table: str | None = None, sql: str | None = None, sql_name: str | None = None, data_source_name: str | None = None, data_source_arn: str | None = None, import_mode: Literal['SPICE', 'DIRECT_QUERY'] = 'DIRECT_QUERY', allowed_to_use: List[str] | _QuicksightPrincipalList | None = None, allowed_to_manage: List[str] | _QuicksightPrincipalList | None = None, logical_table_alias: str = 'LogicalTable', rename_columns: dict[str, str] | None = None, cast_columns_types: dict[str, str] | None = None, tag_columns: dict[str, list[dict[str, Any]]] | None = None, tags: dict[str, str] | None = None, account_id: str | None = None, boto3_session: Session | None = None, namespace: str = 'default') str ¶
Create a QuickSight dataset.
Note
You will not be able to see the the dataset in the console if you not pass your username to one of the
allowed_*
arguments.Note
You must pass
database
/table
ORsql
argument.Note
You must pass
data_source_name
ORdata_source_arn
argument.- Parameters:
name (
str
) – Dataset name.database (
str
|None
) – Athena’s database name.table (
str
|None
) – Athena’s table name.sql (
str
|None
) – Use a SQL query to define your table.sql_name (
str
|None
) – Query name.data_source_name (
str
|None
) – QuickSight data source name.data_source_arn (
str
|None
) – QuickSight data source ARN.import_mode (
Literal
['SPICE'
,'DIRECT_QUERY'
]) – Indicates whether you want to import the data into SPICE.tags (
dict
[str
,str
] |None
) – Key/Value collection to put on the Cluster. e.g. {“foo”: “boo”, “bar”: “xoo”}allowed_to_use (
List
[str
] |_QuicksightPrincipalList
|None
) – Dictionary containing usernames and groups that will be allowed to see and use the data. e.g.`{"users": ["john", "Mary"], "groups": ["engineering", "customers"]}`
Alternatively, if a list of string is passed, it will be interpreted as a list of usernames only.allowed_to_manage (
List
[str
] |_QuicksightPrincipalList
|None
) – Dictionary containing usernames and groups that will be allowed to see, use, update and delete the data source. e.g.`{"users": ["Mary"], "groups": ["engineering"]}`
Alternatively, if a list of string is passed, it will be interpreted as a list of usernames only.logical_table_alias (
str
) – A display name for the logical table.rename_columns (
dict
[str
,str
] |None
) – Dictionary to map column renames. e.g. {“old_name”: “new_name”, “old_name2”: “new_name2”}cast_columns_types (
dict
[str
,str
] |None
) – Dictionary to map column casts. e.g. {“col_name”: “STRING”, “col_name2”: “DECIMAL”} Valid types: ‘STRING’|’INTEGER’|’DECIMAL’|’DATETIME’tag_columns (
dict
[str
,list
[dict
[str
,Any
]]] |None
) – Dictionary to map column tags. e.g. {“col_name”: [{ “ColumnGeographicRole”: “CITY” }],”col_name2”: [{ “ColumnDescription”: { “Text”: “description” }}]} Valid geospatial roles: ‘COUNTRY’|’STATE’|’COUNTY’|’CITY’|’POSTCODE’|’LONGITUDE’|’LATITUDE’account_id (
str
|None
) – If None, the account ID will be inferred from your boto3 session.boto3_session (
Session
|None
) – The default boto3 session will be used if boto3_session isNone
.namespace (
str
) – The namespace. Currently, you should set this to default.
- Return type:
str
- Returns:
Dataset ID.
Examples
>>> import awswrangler as wr >>> dataset_id = wr.quicksight.create_athena_dataset( ... name="...", ... database="..." ... table="..." ... data_source_name="..." ... allowed_to_manage=["Mary"], ... )