Fix #3955 - Filter Pattern generation (#3959)

* Fix missing deprecation

* Fix filterPattern generation
This commit is contained in:
Pere Miquel Brull 2022-04-08 20:58:29 +02:00 committed by GitHub
parent 52abe152cd
commit c6a785b219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{ {
"$id": "https://open-metadata.org/schema/type/filterPattern.json", "$id": "https://open-metadata.org/schema/type/filterPattern.json",
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"title": "FilterPattern", "title": "FilterPatternModel",
"description": "OpenMetadata Ingestion Framework definition.", "description": "OpenMetadata Ingestion Framework definition.",
"type": "object", "type": "object",
"definitions": { "definitions": {

View File

@ -248,7 +248,8 @@ class SQLSource(Source[OMetaDatabaseAndTable]):
self.status.scanned(fqn) self.status.scanned(fqn)
# TODO centralize me # TODO centralize me
def get_table_fqn(self, service_name, db_name, schema_name, table_name) -> str: @staticmethod
def get_table_fqn(service_name, db_name, schema_name, table_name) -> str:
return ".".join((service_name, db_name, schema_name, table_name)) return ".".join((service_name, db_name, schema_name, table_name))
def next_record(self) -> Iterable[Entity]: def next_record(self) -> Iterable[Entity]:
@ -388,8 +389,7 @@ class SQLSource(Source[OMetaDatabaseAndTable]):
) )
except NotImplementedError: except NotImplementedError:
view_definition = "" view_definition = ""
fqn = self.get_table_fqn(self.config.serviceName, schema, view_name)
self.database_source_state.add(fqn)
table = Table( table = Table(
id=uuid.uuid4(), id=uuid.uuid4(),
name=view_name, name=view_name,

View File

@ -15,7 +15,7 @@ Helper that implements table and filter pattern logic
import re import re
from typing import List, Optional from typing import List, Optional
from metadata.generated.schema.type.filterPattern import FilterPatternModel from metadata.generated.schema.type.filterPattern import FilterPattern
class InvalidPatternException(Exception): class InvalidPatternException(Exception):
@ -36,7 +36,7 @@ def validate_regex(regex_list: List[str]) -> None:
raise InvalidPatternException(f"Invalid regex {regex}.") raise InvalidPatternException(f"Invalid regex {regex}.")
def _filter(filter_pattern: Optional[FilterPatternModel], name: str) -> bool: def _filter(filter_pattern: Optional[FilterPattern], name: str) -> bool:
""" """
Return True if the name needs to be filtered, False otherwise Return True if the name needs to be filtered, False otherwise
@ -74,7 +74,7 @@ def _filter(filter_pattern: Optional[FilterPatternModel], name: str) -> bool:
def filter_by_schema( def filter_by_schema(
schema_filter_pattern: Optional[FilterPatternModel], schema_name: str schema_filter_pattern: Optional[FilterPattern], schema_name: str
) -> bool: ) -> bool:
""" """
Return True if the schema needs to be filtered, False otherwise Return True if the schema needs to be filtered, False otherwise
@ -89,7 +89,7 @@ def filter_by_schema(
def filter_by_table( def filter_by_table(
table_filter_pattern: Optional[FilterPatternModel], table_name: str table_filter_pattern: Optional[FilterPattern], table_name: str
) -> bool: ) -> bool:
""" """
Return True if the table needs to be filtered, False otherwise Return True if the table needs to be filtered, False otherwise