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 OR sql argument.

Note

You must pass data_source_name OR data_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, optional) – 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 (dict["users" | "groups", list[str]], optional) – 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 (dict["users" | "groups", list[str]], optional) – 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], 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"]
... )