awswrangler.quicksight.create_athena_dataset¶
- awswrangler.quicksight.create_athena_dataset(name: str, database: Optional[str] = None, table: Optional[str] = None, sql: Optional[str] = None, sql_name: str = 'CustomSQL', data_source_name: Optional[str] = None, data_source_arn: Optional[str] = None, import_mode: str = 'DIRECT_QUERY', allowed_to_use: Optional[List[str]] = None, allowed_to_manage: Optional[List[str]] = None, logical_table_alias: str = 'LogicalTable', rename_columns: Optional[Dict[str, str]] = None, cast_columns_types: Optional[Dict[str, str]] = None, tag_columns: Optional[Dict[str, List[Dict[str, Any]]]] = None, tags: Optional[Dict[str, str]] = None, account_id: Optional[str] = None, boto3_session: Optional[Session] = 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) – Athena’s database name.
table (str) – Athena’s table name.
sql (str) – Use a SQL query to define your table.
sql_name (str) – Query name.
data_source_name (str, optional) – QuickSight data source name.
data_source_arn (str, optional) – QuickSight data source ARN.
import_mode (str) – Indicates whether you want to import the data into SPICE. ‘SPICE’|’DIRECT_QUERY’
tags (Dict[str, str], optional) – Key/Value collection to put on the Cluster. e.g. {“foo”: “boo”, “bar”: “xoo”}
allowed_to_use (optional) – List of usernames that will be allowed to see and use the data source. e.g. [“john”, “Mary”]
allowed_to_manage (optional) – List of usernames that will be allowed to see, use, update and delete the data source. e.g. [“Mary”]
logical_table_alias (str) – A display name for the logical table.
rename_columns (Dict[str, str], optional) – Dictionary to map column renames. e.g. {“old_name”: “new_name”, “old_name2”: “new_name2”}
cast_columns_types (Dict[str, str], optional) – 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]]], optional) –
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, optional) – If None, the account ID will be inferred from your boto3 session.
boto3_session (boto3.Session(), optional) – Boto3 Session. The default boto3 session will be used if boto3_session receive None.
namespace (str) – The namespace. Currently, you should set this to default.
- Returns
Dataset ID.
- Return type
str
Examples
>>> import awswrangler as wr >>> dataset_id = wr.quicksight.create_athena_dataset( ... name="...", ... database="..." ... table="..." ... data_source_name="..." ... allowed_to_manage=["Mary"] ... )