awswrangler.catalog.add_csv_partitions

awswrangler.catalog.add_csv_partitions(database: str, table: str, partitions_values: Dict[str, List[str]], compression: Optional[str] = None, sep: str = ',', boto3_session: Optional[boto3.session.Session] = None) → None

Add partitions (metadata) to a CSV Table in the AWS Glue Catalog.

Parameters
  • database (str) – Database name.

  • table (str) – Table name.

  • partitions_values (Dict[str, List[str]]) – Dictionary with keys as S3 path locations and values as a list of partitions values as str (e.g. {‘s3://bucket/prefix/y=2020/m=10/’: [‘2020’, ‘10’]}).

  • compression (str, optional) – Compression style (None, gzip, etc).

  • sep (str) – String of length 1. Field delimiter for the output file.

  • 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.catalog.add_csv_partitions(
...     database='default',
...     table='my_table',
...     partitions_values={
...         's3://bucket/prefix/y=2020/m=10/': ['2020', '10'],
...         's3://bucket/prefix/y=2020/m=11/': ['2020', '11'],
...         's3://bucket/prefix/y=2020/m=12/': ['2020', '12']
...     }
... )