Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions awswrangler/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def create_parquet_table(
columns_comments: Dict[str, str], optional
Columns names and the related comments (e.g. {'col0': 'Column 0.', 'col1': 'Column 1.', 'col2': 'Partition.'}).
mode: str
'overwrite' to recreate any possible axisting table or 'append' to keep any possible axisting table.
'overwrite' to recreate any possible existing table or 'append' to keep any possible existing table.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
Expand Down Expand Up @@ -967,11 +967,11 @@ def _create_table(
if name in columns_comments:
par["Comment"] = columns_comments[name]
session: boto3.Session = _utils.ensure_session(session=boto3_session)
exist: bool = does_table_exist(database=database, table=table, boto3_session=session)
if (mode == "overwrite") or (exist is False):

if mode == "overwrite":
delete_table_if_exists(database=database, table=table, boto3_session=session)
client_glue: boto3.client = _utils.client(service_name="glue", session=session)
client_glue.create_table(DatabaseName=database, TableInput=table_input)
client_glue: boto3.client = _utils.client(service_name="glue", session=session)
client_glue.create_table(DatabaseName=database, TableInput=table_input)


def _csv_table_definition(
Expand Down
4 changes: 4 additions & 0 deletions awswrangler/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,7 @@ def store_parquet_metadata(
parameters: Optional[Dict[str, str]] = None,
columns_comments: Optional[Dict[str, str]] = None,
compression: Optional[str] = None,
mode: str = "overwrite",
boto3_session: Optional[boto3.Session] = None,
) -> Tuple[Dict[str, str], Optional[Dict[str, str]], Optional[Dict[str, List[str]]]]:
"""Infer and store parquet metadata on AWS Glue Catalog.
Expand Down Expand Up @@ -1769,6 +1770,8 @@ def store_parquet_metadata(
Columns names and the related comments (e.g. {'col0': 'Column 0.', 'col1': 'Column 1.', 'col2': 'Partition.'}).
compression: str, optional
Compression style (``None``, ``snappy``, ``gzip``, etc).
mode: str
'overwrite' to recreate any possible existing table or 'append' to keep any possible existing table.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

Expand Down Expand Up @@ -1813,6 +1816,7 @@ def store_parquet_metadata(
description=description,
parameters=parameters,
columns_comments=columns_comments,
mode=mode,
boto3_session=session,
)
partitions_values: Dict[str, List[str]] = _data_types.athena_partitions_from_pyarrow_partitions(
Expand Down