awswrangler.catalog.delete_table_if_exists

awswrangler.catalog.delete_table_if_exists(database: str, table: str, boto3_session: Optional[boto3.session.Session] = None) → bool

Delete Glue table if exists.

Parameters
  • database (str) – Database name.

  • table (str) – Table name.

  • boto3_session (boto3.Session(), optional) – Boto3 Session. The default boto3 session will be used if boto3_session receive None.

Returns

True if deleted, otherwise False.

Return type

bool

Examples

>>> import awswrangler as wr
>>> wr.catalog.delete_table_if_exists(database='default', name='my_table')  # deleted
True
>>> wr.catalog.delete_table_if_exists(database='default', name='my_table')  # Nothing to be deleted
False