-
Notifications
You must be signed in to change notification settings - Fork 996
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed #10691 support multiDatabase, usage & lineage support for Azure…
… SQL (#12982)
- Loading branch information
1 parent
08461fa
commit 52153db
Showing
9 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
source: | ||
type: azuresql-lineage | ||
serviceName: azuresql | ||
sourceConfig: | ||
config: | ||
type: DatabaseLineage | ||
queryLogDuration: 1 | ||
resultLimit: 10000 | ||
sink: | ||
type: metadata-rest | ||
config: {} | ||
workflowConfig: | ||
openMetadataServerConfig: | ||
hostPort: http://localhost:8585/api | ||
authProvider: openmetadata | ||
securityConfig: | ||
jwtToken: "eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
source: | ||
type: azuresql-usage | ||
serviceName: azuresql | ||
serviceConnection: | ||
config: | ||
type: AzureSQL | ||
database: database | ||
username: username | ||
password: password | ||
hostPort: hostport | ||
driver: ODBC Driver 17 for SQL Server | ||
sourceConfig: | ||
config: | ||
type: DatabaseUsage | ||
queryLogDuration: '1' | ||
processor: | ||
type: query-parser | ||
config: {} | ||
stage: | ||
type: table-usage | ||
config: | ||
filename: /tmp/azuresql_usage | ||
bulkSink: | ||
type: metadata-usage | ||
config: | ||
filename: /tmp/azuresql_usage | ||
workflowConfig: | ||
openMetadataServerConfig: | ||
hostPort: http://localhost:8585/api | ||
authProvider: openmetadata | ||
securityConfig: | ||
jwtToken: "eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg" |
25 changes: 25 additions & 0 deletions
25
ingestion/src/metadata/ingestion/source/database/azuresql/lineage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 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 | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
AZURESQL lineage module | ||
""" | ||
|
||
from metadata.ingestion.source.database.azuresql.query_parser import ( | ||
AzuresqlQueryParserSource, | ||
) | ||
from metadata.ingestion.source.database.mssql.lineage import MssqlLineageSource | ||
|
||
|
||
class AzuresqlLineageSource(AzuresqlQueryParserSource, MssqlLineageSource): | ||
""" | ||
Extending MssqlLineageSource | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
ingestion/src/metadata/ingestion/source/database/azuresql/query_parser.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright 2021 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 | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
AzureSQL usage module | ||
""" | ||
from abc import ABC | ||
|
||
from metadata.generated.schema.entity.services.connections.database.azureSQLConnection import ( | ||
AzureSQLConnection, | ||
) | ||
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import ( | ||
OpenMetadataConnection, | ||
) | ||
from metadata.generated.schema.metadataIngestion.workflow import ( | ||
Source as WorkflowSource, | ||
) | ||
from metadata.ingestion.api.source import InvalidSourceException | ||
from metadata.ingestion.source.database.query_parser_source import QueryParserSource | ||
|
||
|
||
class AzuresqlQueryParserSource(QueryParserSource, ABC): | ||
""" | ||
AzureSQL base for Usage and Lineage | ||
""" | ||
|
||
filters: str | ||
|
||
@classmethod | ||
def create(cls, config_dict, metadata_config: OpenMetadataConnection): | ||
"""Create class instance""" | ||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict) | ||
connection: AzureSQLConnection = config.serviceConnection.__root__.config | ||
if not isinstance(connection, AzureSQLConnection): | ||
raise InvalidSourceException( | ||
f"Expected Azuresql Connection, but got {connection}" | ||
) | ||
return cls(config, metadata_config) |
25 changes: 25 additions & 0 deletions
25
ingestion/src/metadata/ingestion/source/database/azuresql/usage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 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 | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
AzureSQL usage module | ||
""" | ||
|
||
from metadata.ingestion.source.database.azuresql.query_parser import ( | ||
AzuresqlQueryParserSource, | ||
) | ||
from metadata.ingestion.source.database.mssql.usage import MssqlUsageSource | ||
|
||
|
||
class AzuresqlUsageSource(AzuresqlQueryParserSource, MssqlUsageSource): | ||
""" | ||
Extending MssqlUsageSource | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters