mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-17 21:46:50 +00:00
Add policy tags from Bigquery (#10189)
This commit is contained in:
parent
f53d5349ef
commit
785142d86a
1
.gitignore
vendored
1
.gitignore
vendored
@ -71,6 +71,7 @@ openmetadata-ui/src/main/resources/ui/tsconfig.tsbuildinfo
|
|||||||
|
|
||||||
#tests
|
#tests
|
||||||
.coverage*
|
.coverage*
|
||||||
|
!ingestion/.coveragerc
|
||||||
/ingestion/coverage.xml
|
/ingestion/coverage.xml
|
||||||
/ingestion/ci-coverage.xml
|
/ingestion/ci-coverage.xml
|
||||||
/ingestion/junit/*
|
/ingestion/junit/*
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
-- Unique constraint for user email address
|
-- Unique constraint for user email address
|
||||||
ALTER TABLE user_entity
|
ALTER TABLE user_entity
|
||||||
ADD UNIQUE (email);
|
ADD UNIQUE (email);
|
||||||
|
|
||||||
|
|
||||||
|
-- Remove classificationName in BigQuery
|
||||||
|
UPDATE dbservice_entity
|
||||||
|
SET json = JSON_REMOVE(json, '$.connection.config.classificationName') where serviceType in ('BigQuery');
|
@ -1,3 +1,7 @@
|
|||||||
-- Unique constraint for user email address
|
-- Unique constraint for user email address
|
||||||
ALTER TABLE user_entity
|
ALTER TABLE user_entity
|
||||||
ADD UNIQUE (email);
|
ADD UNIQUE (email);
|
||||||
|
|
||||||
|
|
||||||
|
-- Remove classificationName in BigQuery
|
||||||
|
UPDATE dbservice_entity SET json = json #- '{connection,config,classificationName}' where serviceType in ('BigQuery');
|
@ -64,6 +64,7 @@ services:
|
|||||||
dockerfile: docker/local-metadata/Dockerfile
|
dockerfile: docker/local-metadata/Dockerfile
|
||||||
container_name: openmetadata_server
|
container_name: openmetadata_server
|
||||||
environment:
|
environment:
|
||||||
|
OPENMETADATA_DEBUG: ${OPENMETADATA_DEBUG:-false}
|
||||||
# OpenMetadata Server Authentication Configuration
|
# OpenMetadata Server Authentication Configuration
|
||||||
AUTHORIZER_CLASS_NAME: ${AUTHORIZER_CLASS_NAME:-org.openmetadata.service.security.DefaultAuthorizer}
|
AUTHORIZER_CLASS_NAME: ${AUTHORIZER_CLASS_NAME:-org.openmetadata.service.security.DefaultAuthorizer}
|
||||||
AUTHORIZER_REQUEST_FILTER: ${AUTHORIZER_REQUEST_FILTER:-org.openmetadata.service.security.JwtFilter}
|
AUTHORIZER_REQUEST_FILTER: ${AUTHORIZER_REQUEST_FILTER:-org.openmetadata.service.security.JwtFilter}
|
||||||
@ -111,9 +112,11 @@ services:
|
|||||||
expose:
|
expose:
|
||||||
- 8585
|
- 8585
|
||||||
- 8586
|
- 8586
|
||||||
|
- 5005
|
||||||
ports:
|
ports:
|
||||||
- "8585:8585"
|
- "8585:8585"
|
||||||
- "8586:8586"
|
- "8586:8586"
|
||||||
|
- "5005:5005"
|
||||||
depends_on:
|
depends_on:
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
@ -131,13 +134,6 @@ services:
|
|||||||
args:
|
args:
|
||||||
INGESTION_DEPENDENCY: ${INGESTION_DEPENDENCY:-all}
|
INGESTION_DEPENDENCY: ${INGESTION_DEPENDENCY:-all}
|
||||||
container_name: openmetadata_ingestion
|
container_name: openmetadata_ingestion
|
||||||
depends_on:
|
|
||||||
elasticsearch:
|
|
||||||
condition: service_started
|
|
||||||
postgresql:
|
|
||||||
condition: service_healthy
|
|
||||||
openmetadata-server:
|
|
||||||
condition: service_started
|
|
||||||
environment:
|
environment:
|
||||||
AIRFLOW__API__AUTH_BACKENDS: "airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session"
|
AIRFLOW__API__AUTH_BACKENDS: "airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session"
|
||||||
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
||||||
@ -151,6 +147,13 @@ services:
|
|||||||
entrypoint: /bin/bash
|
entrypoint: /bin/bash
|
||||||
command:
|
command:
|
||||||
- "/opt/airflow/ingestion_dependency.sh"
|
- "/opt/airflow/ingestion_dependency.sh"
|
||||||
|
depends_on:
|
||||||
|
elasticsearch:
|
||||||
|
condition: service_started
|
||||||
|
postgresql:
|
||||||
|
condition: service_healthy
|
||||||
|
openmetadata-server:
|
||||||
|
condition: service_started
|
||||||
expose:
|
expose:
|
||||||
- 8080
|
- 8080
|
||||||
ports:
|
ports:
|
||||||
@ -163,6 +166,7 @@ services:
|
|||||||
- ingestion-volume-tmp:/tmp
|
- ingestion-volume-tmp:/tmp
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:z # Need 600 permissions to run DockerOperator
|
- /var/run/docker.sock:/var/run/docker.sock:z # Need 600 permissions to run DockerOperator
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
local_app_net:
|
local_app_net:
|
||||||
name: ometa_network
|
name: ometa_network
|
||||||
|
@ -84,9 +84,22 @@ def get_columns(bq_schema):
|
|||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
if field.policy_tags:
|
if field.policy_tags:
|
||||||
|
policy_tag_name = field.policy_tags.names[0]
|
||||||
|
taxonomy_name = (
|
||||||
|
policy_tag_name.split("/policyTags/")[0] if policy_tag_name else ""
|
||||||
|
)
|
||||||
|
if not taxonomy_name:
|
||||||
|
raise NotImplementedError(
|
||||||
|
f"Taxonomy Name not present for {field.name}"
|
||||||
|
)
|
||||||
|
col_obj["taxonomy"] = (
|
||||||
|
PolicyTagManagerClient()
|
||||||
|
.get_taxonomy(name=taxonomy_name)
|
||||||
|
.display_name
|
||||||
|
)
|
||||||
col_obj["policy_tags"] = (
|
col_obj["policy_tags"] = (
|
||||||
PolicyTagManagerClient()
|
PolicyTagManagerClient()
|
||||||
.get_policy_tag(name=field.policy_tags.names[0])
|
.get_policy_tag(name=policy_tag_name)
|
||||||
.display_name
|
.display_name
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
@ -162,11 +175,11 @@ class BigquerySource(CommonDbSourceService):
|
|||||||
for tag in policy_tags:
|
for tag in policy_tags:
|
||||||
yield OMetaTagAndClassification(
|
yield OMetaTagAndClassification(
|
||||||
classification_request=CreateClassificationRequest(
|
classification_request=CreateClassificationRequest(
|
||||||
name=self.service_connection.classificationName,
|
name=taxonomy.display_name,
|
||||||
description="",
|
description="",
|
||||||
),
|
),
|
||||||
tag_request=CreateTagRequest(
|
tag_request=CreateTagRequest(
|
||||||
classification=self.service_connection.classificationName,
|
classification=taxonomy.display_name,
|
||||||
name=tag.display_name,
|
name=tag.display_name,
|
||||||
description="Bigquery Policy Tag",
|
description="Bigquery Policy Tag",
|
||||||
),
|
),
|
||||||
@ -195,7 +208,7 @@ class BigquerySource(CommonDbSourceService):
|
|||||||
tagFQN=fqn.build(
|
tagFQN=fqn.build(
|
||||||
self.metadata,
|
self.metadata,
|
||||||
entity_type=Tag,
|
entity_type=Tag,
|
||||||
classification_name=self.service_connection.classificationName,
|
classification_name=column["taxonomy"],
|
||||||
tag_name=column["policy_tags"],
|
tag_name=column["policy_tags"],
|
||||||
),
|
),
|
||||||
labelType="Automated",
|
labelType="Automated",
|
||||||
|
@ -50,7 +50,6 @@ from metadata.generated.schema.entity.services.pipelineService import PipelineSe
|
|||||||
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
|
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
|
||||||
OpenMetadataJWTClientConfig,
|
OpenMetadataJWTClientConfig,
|
||||||
)
|
)
|
||||||
from metadata.generated.schema.type.entityReference import EntityReference
|
|
||||||
from metadata.ingestion.ometa.ometa_api import OpenMetadata
|
from metadata.ingestion.ometa.ometa_api import OpenMetadata
|
||||||
|
|
||||||
OM_HOST_PORT = "http://localhost:8585/api"
|
OM_HOST_PORT = "http://localhost:8585/api"
|
||||||
|
@ -47,12 +47,6 @@
|
|||||||
"description": "GCS Credentials",
|
"description": "GCS Credentials",
|
||||||
"$ref": "../../../../security/credentials/gcsCredentials.json"
|
"$ref": "../../../../security/credentials/gcsCredentials.json"
|
||||||
},
|
},
|
||||||
"classificationName": {
|
|
||||||
"title": "Classification Name",
|
|
||||||
"description": "Custom OpenMetadata Classification name for BigQuery policy tags.",
|
|
||||||
"type": "string",
|
|
||||||
"default": "BigqueryPolicyTags"
|
|
||||||
},
|
|
||||||
"partitionQueryDuration": {
|
"partitionQueryDuration": {
|
||||||
"title": "Partition Query Duration",
|
"title": "Partition Query Duration",
|
||||||
"description": "Duration for partitioning BigQuery tables.",
|
"description": "Duration for partitioning BigQuery tables.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user