Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingest/hive): identify partition columns in hive tables #12833

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions metadata-ingestion/src/datahub/ingestion/source/sql/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ def get_schema_fields_for_column(
column,
inspector,
pk_constraints,
partition_keys=partition_keys,
)

if self._COMPLEX_TYPE.match(fields[0].nativeDataType) and isinstance(
Expand Down Expand Up @@ -849,3 +850,15 @@ def _process_view(
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 []
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,8 @@
},
"nativeDataType": "string",
"recursive": false,
"isPartOfKey": false
"isPartOfKey": false,
"isPartitioningKey": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,8 @@
},
"nativeDataType": "string",
"recursive": false,
"isPartOfKey": false
"isPartOfKey": false,
"isPartitioningKey": true
}
]
}
Expand Down
Loading