Skip to content

Commit 8bf8310

Browse files
authored
Skip information_schema when purging catalog (#539)
1 parent 2212a0b commit 8bf8310

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

databricks_cli/unity_catalog/catalog_cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ def delete_catalog_cli(api_client, name, purge):
121121
"""
122122
if purge:
123123
tables_response = UnityCatalogApi(api_client).list_table_summaries(name)
124-
for t in tables_response.get('tables', []):
124+
tables = tables_response.get('tables', [])
125+
tables = filter(lambda t: t['full_name'].split('.')[1] != 'information_schema', tables)
126+
for t in tables:
125127
click.echo("Deleting table: %s" % (t['full_name']))
126128
UnityCatalogApi(api_client).delete_table(t['full_name'])
127129

128130
schemas_response = UnityCatalogApi(api_client).list_schemas(name, None)
129-
for s in schemas_response.get('schemas', []):
131+
schemas = schemas_response.get('schemas', [])
132+
schemas = filter(lambda s: s['name'] != 'information_schema', schemas)
133+
for s in schemas:
130134
click.echo("Purging schema: %s" % (s['full_name']))
131135
UnityCatalogApi(api_client).delete_schema(s['full_name'])
132136

0 commit comments

Comments
 (0)