partition and clustering bigquery keys (#6212)
* partition and clustering bigquery keys * flake8
This commit is contained in:
parent
acb44165b4
commit
71d6ff40d0
|
|
@ -1433,6 +1433,28 @@ class BQEngineSpec(BaseEngineSpec):
|
|||
'128 characters'.format(mutated_label))
|
||||
return mutated_label
|
||||
|
||||
@classmethod
|
||||
def extra_table_metadata(cls, database, table_name, schema_name):
|
||||
indexes = database.get_indexes(table_name, schema_name)
|
||||
if not indexes:
|
||||
return {}
|
||||
partitions_columns = [
|
||||
index.get('column_names', []) for index in indexes
|
||||
if index.get('name') == 'partition'
|
||||
]
|
||||
cluster_columns = [
|
||||
index.get('column_names', []) for index in indexes
|
||||
if index.get('name') == 'clustering'
|
||||
]
|
||||
return {
|
||||
'partitions': {
|
||||
'cols': partitions_columns,
|
||||
},
|
||||
'clustering': {
|
||||
'cols': cluster_columns,
|
||||
},
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def _get_fields(cls, cols):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue