mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-12 18:47:45 +00:00
feat(ingest/hive): identify partition columns in hive tables (#12833)
This commit is contained in:
parent
0e62e8c77a
commit
eb17f80e8a
@ -777,6 +777,7 @@ class HiveSource(TwoTierSQLAlchemySource):
|
||||
column,
|
||||
inspector,
|
||||
pk_constraints,
|
||||
partition_keys=partition_keys,
|
||||
)
|
||||
|
||||
if self._COMPLEX_TYPE.match(fields[0].nativeDataType) and isinstance(
|
||||
@ -849,3 +850,15 @@ class HiveSource(TwoTierSQLAlchemySource):
|
||||
default_db=default_db,
|
||||
default_schema=default_schema,
|
||||
)
|
||||
|
||||
def get_partitions(
|
||||
self, inspector: Inspector, schema: str, table: str
|
||||
) -> Optional[List[str]]:
|
||||
partition_columns: List[dict] = inspector.get_indexes(
|
||||
table_name=table, schema=schema
|
||||
)
|
||||
for partition_column in partition_columns:
|
||||
if partition_column.get("column_names"):
|
||||
return partition_column.get("column_names")
|
||||
|
||||
return []
|
||||
|
||||
@ -1255,7 +1255,8 @@
|
||||
},
|
||||
"nativeDataType": "string",
|
||||
"recursive": false,
|
||||
"isPartOfKey": false
|
||||
"isPartOfKey": false,
|
||||
"isPartitioningKey": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1255,7 +1255,8 @@
|
||||
},
|
||||
"nativeDataType": "string",
|
||||
"recursive": false,
|
||||
"isPartOfKey": false
|
||||
"isPartOfKey": false,
|
||||
"isPartitioningKey": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user