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, tags: Optional[Dict[str, str]] = None, account_id: Optional[str] = None, boto3_session: Optional[boto3.session.Session] = None) → None

Create a QuickSight dataset.

Note

You will not be able to see the the dataset in the console if you not pass your user 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) – 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 principals that will be allowed to see and use the data source. e.g. [“john”, “Mary”]

  • allowed_to_manage (optional) – List of principals 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’

  • 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.

Returns

None.

Return type

None

Examples

>>> import awswrangler as wr
>>> wr.quicksight.create_athena_dataset(
...     name="...",
...     database="..."
...     table="..."
...     data_source_name="..."
...     allowed_to_manage=["Mary"]
... )