@@ -365,7 +365,14 @@ def __init__(self, backend: SqlBackend, schema, include_databases: list[str] | N
365
365
366
366
def _all_databases (self ) -> list [str ]:
367
367
if not self ._include_database :
368
- return [row [0 ] for row in self ._fetch ("SHOW DATABASES" )]
368
+ databases = []
369
+ for row in self ._fetch ("SHOW DATABASES" ):
370
+ database = row [0 ]
371
+ if database == self ._schema :
372
+ logger .debug (f"Skipping UCX inventory schema: { database } " )
373
+ continue
374
+ databases .append (database )
375
+ return databases
369
376
return self ._include_database
370
377
371
378
def load_one (self , schema_name : str , table_name : str ) -> Table | None :
@@ -603,6 +610,9 @@ def _crawl(self) -> Iterable[Table]:
603
610
catalog = "hive_metastore"
604
611
databases = self ._all_databases ()
605
612
for database in databases :
613
+ if database == self ._schema :
614
+ logger .debug (f"Skipping UCX inventory schema: { database } " )
615
+ continue
606
616
logger .info (f"Scanning { database } " )
607
617
table_names = self ._get_table_names (database )
608
618
tasks .extend (self ._create_describe_tasks (catalog , database , table_names ))
@@ -619,6 +629,7 @@ def _get_table_names(self, database: str) -> list[str]:
619
629
:param database:
620
630
:return: list of table names
621
631
"""
632
+ # TODO: this method is redundant and can be removed in favor of using _list_tables directly
622
633
table_names = []
623
634
table_names_batches = Threads .strict ('listing tables' , [partial (self ._list_tables , database )])
624
635
for table_batch in table_names_batches :
0 commit comments