mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-14 12:06:54 +00:00
MINOR: Add support for cluster key information - bigquery (#19727)
(cherry picked from commit 155571f50a9b313a32be5c76ed1975f10341b519)
This commit is contained in:
parent
83f21e7407
commit
01c77d28a2
@ -34,9 +34,11 @@ from metadata.generated.schema.entity.data.database import Database
|
||||
from metadata.generated.schema.entity.data.databaseSchema import DatabaseSchema
|
||||
from metadata.generated.schema.entity.data.storedProcedure import StoredProcedureCode
|
||||
from metadata.generated.schema.entity.data.table import (
|
||||
ConstraintType,
|
||||
PartitionColumnDetails,
|
||||
PartitionIntervalTypes,
|
||||
Table,
|
||||
TableConstraint,
|
||||
TablePartition,
|
||||
TableType,
|
||||
)
|
||||
@ -96,6 +98,7 @@ from metadata.ingestion.source.database.life_cycle_query_mixin import (
|
||||
from metadata.ingestion.source.database.multi_db_source import MultiDBSource
|
||||
from metadata.utils import fqn
|
||||
from metadata.utils.credentials import GOOGLE_CREDENTIALS
|
||||
from metadata.utils.execution_time_tracker import calculate_execution_time
|
||||
from metadata.utils.filters import filter_by_database, filter_by_schema
|
||||
from metadata.utils.logger import ingestion_logger
|
||||
from metadata.utils.sqlalchemy_utils import (
|
||||
@ -657,6 +660,42 @@ class BigquerySource(LifeCycleQueryMixin, CommonDbSourceService, MultiDBSource):
|
||||
)
|
||||
return None
|
||||
|
||||
@calculate_execution_time()
|
||||
def update_table_constraints(
|
||||
self,
|
||||
table_name,
|
||||
schema_name,
|
||||
db_name,
|
||||
table_constraints,
|
||||
foreign_columns,
|
||||
columns,
|
||||
) -> List[TableConstraint]:
|
||||
"""
|
||||
From topology.
|
||||
process the table constraints of all tables
|
||||
"""
|
||||
table_constraints = super().update_table_constraints(
|
||||
table_name,
|
||||
schema_name,
|
||||
db_name,
|
||||
table_constraints,
|
||||
foreign_columns,
|
||||
columns,
|
||||
)
|
||||
try:
|
||||
table = self.client.get_table(fqn._build(db_name, schema_name, table_name))
|
||||
if hasattr(table, "clustering_fields") and table.clustering_fields:
|
||||
table_constraints.append(
|
||||
TableConstraint(
|
||||
constraintType=ConstraintType.CLUSTER_KEY,
|
||||
columns=table.clustering_fields,
|
||||
)
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.warning(f"Error getting clustering fields for {table_name}: {exc}")
|
||||
logger.debug(traceback.format_exc())
|
||||
return table_constraints
|
||||
|
||||
def get_table_partition_details(
|
||||
self, table_name: str, schema_name: str, inspector: Inspector
|
||||
) -> Tuple[bool, Optional[TablePartition]]:
|
||||
|
@ -193,7 +193,8 @@
|
||||
"PRIMARY_KEY",
|
||||
"FOREIGN_KEY",
|
||||
"SORT_KEY",
|
||||
"DIST_KEY"
|
||||
"DIST_KEY",
|
||||
"CLUSTER_KEY"
|
||||
]
|
||||
},
|
||||
"columns": {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2024 Collate.
|
||||
* Copyright 2025 Collate.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -10,9 +10,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* A `Table` entity organizes data in rows and columns and is defined in a `Database Schema`.
|
||||
*/
|
||||
export interface Table {
|
||||
@ -1064,6 +1062,7 @@ export interface TableConstraint {
|
||||
}
|
||||
|
||||
export enum ConstraintType {
|
||||
ClusterKey = "CLUSTER_KEY",
|
||||
DistKey = "DIST_KEY",
|
||||
ForeignKey = "FOREIGN_KEY",
|
||||
PrimaryKey = "PRIMARY_KEY",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Geschlossene Aufgaben",
|
||||
"closed-this-task-lowercase": "diese Aufgabe schließen",
|
||||
"cloud-config-source": "Cloud-Konfigurationsquelle",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Alle minimieren",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Closed Tasks",
|
||||
"closed-this-task-lowercase": "closed this task",
|
||||
"cloud-config-source": "Cloud Config Source",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Collapse All",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Tareas cerradas",
|
||||
"closed-this-task-lowercase": "cerró esta tarea",
|
||||
"cloud-config-source": "Fuente de configuración en el cloud",
|
||||
"cluster": "Cluster",
|
||||
"code": "Código",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Contraer todo",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Tâches Clôturées",
|
||||
"closed-this-task-lowercase": "fermer cette tâche",
|
||||
"cloud-config-source": "Source de Configuration Cloud",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Tout Réduire",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Tarefas pechadas",
|
||||
"closed-this-task-lowercase": "pechou esta tarefa",
|
||||
"cloud-config-source": "Fonte de configuración na nube",
|
||||
"cluster": "Cluster",
|
||||
"code": "Código",
|
||||
"collapse": "Colapsar",
|
||||
"collapse-all": "Colapsar todo",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "משימות סגורות",
|
||||
"closed-this-task-lowercase": "סגר את המשימה הזו",
|
||||
"cloud-config-source": "מקור תצורת ענן",
|
||||
"cluster": "Cluster",
|
||||
"code": "קוד",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "קפיצה לתחתית",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "終了したタスク",
|
||||
"closed-this-task-lowercase": "このタスクを終了する",
|
||||
"cloud-config-source": "Cloud Config Source",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "全て折り畳む",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "बंद केलेली कार्ये",
|
||||
"closed-this-task-lowercase": "हे कार्य बंद केले",
|
||||
"cloud-config-source": "क्लाउड कॉन्फिग स्रोत",
|
||||
"cluster": "Cluster",
|
||||
"code": "कोड",
|
||||
"collapse": "संकुचित करा",
|
||||
"collapse-all": "सर्व संकुचित करा",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Gesloten taken",
|
||||
"closed-this-task-lowercase": "deze taak gesloten",
|
||||
"cloud-config-source": "Cloud Config-bron",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Alles inklappen",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "وظایف بسته شده",
|
||||
"closed-this-task-lowercase": "این وظیفه بسته شد",
|
||||
"cloud-config-source": "منبع پیکربندی ابری",
|
||||
"cluster": "Cluster",
|
||||
"code": "کد",
|
||||
"collapse": "فروپاشی",
|
||||
"collapse-all": "فروپاشی همه",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Tarefas Fechadas",
|
||||
"closed-this-task-lowercase": "fechou esta tarefa",
|
||||
"cloud-config-source": "Fonte de Configuração na Nuvem",
|
||||
"cluster": "Cluster",
|
||||
"code": "Código",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Recolher Tudo",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Tarefas Fechadas",
|
||||
"closed-this-task-lowercase": "fechou esta tarefa",
|
||||
"cloud-config-source": "Fonte de Configuração na Nuvem",
|
||||
"cluster": "Cluster",
|
||||
"code": "Código",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Recolher Tudo",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "Закрытые задачи",
|
||||
"closed-this-task-lowercase": "закрыть задачу",
|
||||
"cloud-config-source": "Источник облачной конфигурации",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "Collapse",
|
||||
"collapse-all": "Свернуть все",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "งานที่ปิดแล้ว",
|
||||
"closed-this-task-lowercase": "ปิดงานนี้",
|
||||
"cloud-config-source": "แหล่งที่มาของการกำหนดค่าบนคลาวด์",
|
||||
"cluster": "Cluster",
|
||||
"code": "รหัส",
|
||||
"collapse": "ย่อ",
|
||||
"collapse-all": "ย่อทั้งหมด",
|
||||
|
@ -181,6 +181,7 @@
|
||||
"closed-task-plural": "已关闭任务",
|
||||
"closed-this-task-lowercase": "关闭此任务",
|
||||
"cloud-config-source": "云配置源",
|
||||
"cluster": "Cluster",
|
||||
"code": "Code",
|
||||
"collapse": "折叠",
|
||||
"collapse-all": "全部折叠",
|
||||
|
@ -247,6 +247,15 @@ export const getConstraintIcon = ({
|
||||
|
||||
break;
|
||||
}
|
||||
case ConstraintType.ClusterKey: {
|
||||
title = t('label.entity-key', {
|
||||
entity: t('label.cluster'),
|
||||
});
|
||||
icon = isConstraintDeleted ? IconDistLineThrough : IconDistKey;
|
||||
dataTestId = 'cluster-key';
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user