File tree Expand file tree Collapse file tree
src/metadata/ingestion/source/database/hive
tests/unit/topology/database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,7 +172,9 @@ def get_schema_definition( # pylint: disable=unused-argument
172172 return None
173173
174174 def _build_metastore_partition_query (self , drivername : str ) -> str :
175- q = lambda name : f'"{ name } "' if drivername == "hive+postgres" else name # noqa: E731
175+ q = (
176+ lambda name : f'"{ name } "' if drivername == "hive+postgres" else name
177+ ) # noqa: E731
176178 return (
177179 f"SELECT pk.{ q ('PKEY_NAME' )} "
178180 f" FROM { q ('PARTITION_KEYS' )} pk"
@@ -197,8 +199,11 @@ def _get_partition_keys_from_describe(
197199 ) -> List [str ]:
198200 partition_keys : List [str ] = []
199201 in_partition_section = False
202+ identifier_preparer = self .engine .dialect .identifier_preparer
203+ quoted_schema_name = identifier_preparer .quote_identifier (schema_name )
204+ quoted_table_name = identifier_preparer .quote_identifier (table_name )
200205 rows = self .connection .execute (
201- text (f"DESCRIBE FORMATTED ` { schema_name } `.` { table_name } ` " )
206+ text (f"DESCRIBE FORMATTED { quoted_schema_name } . { quoted_table_name } " )
202207 )
203208 for row in rows :
204209 col_name = row [0 ].strip () if row [0 ] else ""
Original file line number Diff line number Diff line change @@ -360,15 +360,15 @@ def __init__(
360360 self .thread_id = self .hive .context .get_current_thread_id ()
361361 self .hive ._inspector_map [self .thread_id ] = types .SimpleNamespace ()
362362
363- self .hive ._inspector_map [self . thread_id ]. get_pk_constraint = (
364- lambda table_name , schema_name : []
365- )
366- self .hive ._inspector_map [self . thread_id ]. get_unique_constraints = (
367- lambda table_name , schema_name : []
368- )
369- self .hive ._inspector_map [self . thread_id ]. get_foreign_keys = (
370- lambda table_name , schema_name : []
371- )
363+ self .hive ._inspector_map [
364+ self . thread_id
365+ ]. get_pk_constraint = lambda table_name , schema_name : []
366+ self .hive ._inspector_map [
367+ self . thread_id
368+ ]. get_unique_constraints = lambda table_name , schema_name : []
369+ self .hive ._inspector_map [
370+ self . thread_id
371+ ]. get_foreign_keys = lambda table_name , schema_name : []
372372
373373 def test_yield_database (self ):
374374 assert EXPECTED_DATABASE == [
You can’t perform that action at this time.
0 commit comments