mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-13 01:38:13 +00:00
Filter Pattern Modification
This commit is contained in:
parent
5191cc2dca
commit
f5194669ae
@ -63,6 +63,6 @@ def metadata_ingestion_workflow():
|
||||
workflow.stop()
|
||||
```
|
||||
|
||||
Create a Worfklow instance and pass a hive configuration which will read metadata from Hive
|
||||
Create a Workflow instance and pass a hive configuration which will read metadata from Hive
|
||||
and ingest into OpenMetadata Server. You can customize this configuration or add different connectors please refer to our [examples](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/examples/workflows) and refer to [Metadata Connectors](
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
"database":"catalog_test",
|
||||
"username": "sa",
|
||||
"password": "test!Password",
|
||||
"include_pattern": {
|
||||
"filter_pattern": {
|
||||
"excludes": ["catalog_test.*"]
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
"account": "account_name",
|
||||
"service_name": "snowflake",
|
||||
"service_type": "Snowflake",
|
||||
"include_pattern": {
|
||||
"filter_pattern": {
|
||||
"includes": [
|
||||
"(\\w)*tpcds_sf100tcl",
|
||||
"(\\w)*tpcds_sf100tcl",
|
||||
|
@ -6,7 +6,7 @@
|
||||
"password": "openmetadata_password",
|
||||
"service_name": "local_mysql",
|
||||
"service_type": "MySQL",
|
||||
"include_pattern": {
|
||||
"filter_pattern": {
|
||||
"excludes": ["mysql.*", "information_schema.*"]
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ class IncludeFilterPattern(ConfigModel):
|
||||
raise Exception("Regex Error: {}".format(err))
|
||||
|
||||
def is_fully_specified_include_list(self) -> bool:
|
||||
for include_pattern in self.includes:
|
||||
if not self.alphabet_pattern.match(include_pattern):
|
||||
for filter_pattern in self.includes:
|
||||
if not self.alphabet_pattern.match(filter_pattern):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -38,8 +38,7 @@ class LdapRestUsersSink(Sink):
|
||||
self.config = config
|
||||
self.metadata_config = metadata_config
|
||||
self.status = SinkStatus()
|
||||
self.api_users = self.metadata_config.api_endpoint + "/v1/users"
|
||||
self.headers = {'Content-type': 'application/json'}
|
||||
self.api_users = "/users"
|
||||
self.rest = REST(metadata_config)
|
||||
|
||||
@classmethod
|
||||
|
@ -95,7 +95,7 @@ class PostgresSource(Source):
|
||||
self.metadata_config = metadata_config
|
||||
self.status = SQLSourceStatus()
|
||||
self.service = get_service_or_create(config, metadata_config)
|
||||
self.include_pattern = IncludeFilterPattern
|
||||
self.filter_pattern = IncludeFilterPattern
|
||||
self.pattern = config
|
||||
|
||||
@classmethod
|
||||
@ -144,7 +144,7 @@ class PostgresSource(Source):
|
||||
col_type = 'BOOLEAN'
|
||||
else:
|
||||
col_type = None
|
||||
if not self.pattern.include_pattern.included(f'{last_row[1]}.{last_row[2]}'):
|
||||
if not self.pattern.filter_pattern.included(f'{last_row[1]}.{last_row[2]}'):
|
||||
self.status.filtered(f'{last_row[1]}.{last_row[2]}', "pattern not allowed", last_row[2])
|
||||
continue
|
||||
if col_type is not None:
|
||||
|
@ -66,7 +66,7 @@ class SQLConnectionConfig(ConfigModel):
|
||||
service_name: str
|
||||
service_type: str
|
||||
options: dict = {}
|
||||
include_pattern: IncludeFilterPattern = IncludeFilterPattern.allow_all()
|
||||
filter_pattern: IncludeFilterPattern = IncludeFilterPattern.allow_all()
|
||||
|
||||
@abstractmethod
|
||||
def get_connection_url(self):
|
||||
@ -174,7 +174,7 @@ class SQLSource(Source):
|
||||
engine = create_engine(url, **sql_config.options)
|
||||
inspector = inspect(engine)
|
||||
for schema in inspector.get_schema_names():
|
||||
if not sql_config.include_pattern.included(schema):
|
||||
if not sql_config.filter_pattern.included(schema):
|
||||
self.status.filtered(schema, "Schema pattern not allowed")
|
||||
continue
|
||||
logger.debug("total tables {}".format(inspector.get_table_names(schema)))
|
||||
@ -196,7 +196,7 @@ class SQLSource(Source):
|
||||
|
||||
dataset_name = f"{schema}.{table}"
|
||||
self.status.scanned('{}.{}'.format(self.config.get_service_name(), dataset_name))
|
||||
if not sql_config.include_pattern.included(dataset_name):
|
||||
if not sql_config.filter_pattern.included(dataset_name):
|
||||
self.status.filtered('{}.{}'.format(self.config.get_service_name(), dataset_name),
|
||||
"Table pattern not allowed")
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user