-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openlineage: migrate OpenLineage provider to V2 facets. (#39530)
* Migrate OpenLineage proivder to V2 facets. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> * Migrate amazon to v2 facets. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> * Migrate OL-dependent providers to v2 facets. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> * Migrate Google provider to V2 facets. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> * Make migration backwards-compatible with previous OL provider versions. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> * Move V2 facets code imports to `common.compat` provider. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> * Add pre-commit hook for check on `common.compat` imports over OL v1. Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com> --------- Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>
- Loading branch information
1 parent
9ec9eb7
commit 0206a4c
Showing
78 changed files
with
1,046 additions
and
666 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
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
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
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,16 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. |
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,158 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
|
||
def create_no_op(*_, **__) -> None: | ||
""" | ||
Create a no-op placeholder. | ||
This function creates and returns a None value, used as a placeholder when the OpenLineage client | ||
library is available. It represents an action that has no effect. | ||
""" | ||
return None | ||
|
||
|
||
if TYPE_CHECKING: | ||
from openlineage.client.generated.base import ( | ||
BaseFacet, | ||
Dataset, | ||
DatasetFacet, | ||
InputDataset, | ||
OutputDataset, | ||
RunFacet, | ||
) | ||
from openlineage.client.generated.column_lineage_dataset import ( | ||
ColumnLineageDatasetFacet, | ||
Fields, | ||
InputField, | ||
) | ||
from openlineage.client.generated.documentation_dataset import DocumentationDatasetFacet | ||
from openlineage.client.generated.error_message_run import ErrorMessageRunFacet | ||
from openlineage.client.generated.external_query_run import ExternalQueryRunFacet | ||
from openlineage.client.generated.extraction_error_run import Error, ExtractionErrorRunFacet | ||
from openlineage.client.generated.lifecycle_state_change_dataset import ( | ||
LifecycleStateChange, | ||
LifecycleStateChangeDatasetFacet, | ||
PreviousIdentifier, | ||
) | ||
from openlineage.client.generated.output_statistics_output_dataset import ( | ||
OutputStatisticsOutputDatasetFacet, | ||
) | ||
from openlineage.client.generated.schema_dataset import SchemaDatasetFacet, SchemaDatasetFacetFields | ||
from openlineage.client.generated.sql_job import SQLJobFacet | ||
from openlineage.client.generated.symlinks_dataset import Identifier, SymlinksDatasetFacet | ||
else: | ||
try: | ||
try: | ||
from openlineage.client.generated.base import ( | ||
BaseFacet, | ||
Dataset, | ||
DatasetFacet, | ||
InputDataset, | ||
OutputDataset, | ||
RunFacet, | ||
) | ||
from openlineage.client.generated.column_lineage_dataset import ( | ||
ColumnLineageDatasetFacet, | ||
Fields, | ||
InputField, | ||
) | ||
from openlineage.client.generated.documentation_dataset import DocumentationDatasetFacet | ||
from openlineage.client.generated.error_message_run import ErrorMessageRunFacet | ||
from openlineage.client.generated.external_query_run import ExternalQueryRunFacet | ||
from openlineage.client.generated.extraction_error_run import Error, ExtractionErrorRunFacet | ||
from openlineage.client.generated.lifecycle_state_change_dataset import ( | ||
LifecycleStateChange, | ||
LifecycleStateChangeDatasetFacet, | ||
PreviousIdentifier, | ||
) | ||
from openlineage.client.generated.output_statistics_output_dataset import ( | ||
OutputStatisticsOutputDatasetFacet, | ||
) | ||
from openlineage.client.generated.schema_dataset import ( | ||
SchemaDatasetFacet, | ||
SchemaDatasetFacetFields, | ||
) | ||
from openlineage.client.generated.sql_job import SQLJobFacet | ||
from openlineage.client.generated.symlinks_dataset import Identifier, SymlinksDatasetFacet | ||
except ImportError: | ||
from openlineage.client.facet import ( | ||
BaseFacet, | ||
BaseFacet as DatasetFacet, | ||
BaseFacet as RunFacet, | ||
ColumnLineageDatasetFacet, | ||
ColumnLineageDatasetFacetFieldsAdditional as Fields, | ||
ColumnLineageDatasetFacetFieldsAdditionalInputFields as InputField, | ||
DocumentationDatasetFacet, | ||
ErrorMessageRunFacet, | ||
ExternalQueryRunFacet, | ||
ExtractionError as Error, | ||
ExtractionErrorRunFacet, | ||
LifecycleStateChange, | ||
LifecycleStateChangeDatasetFacet, | ||
LifecycleStateChangeDatasetFacetPreviousIdentifier as PreviousIdentifier, | ||
OutputStatisticsOutputDatasetFacet, | ||
SchemaDatasetFacet, | ||
SchemaField as SchemaDatasetFacetFields, | ||
SqlJobFacet as SQLJobFacet, | ||
SymlinksDatasetFacet, | ||
SymlinksDatasetFacetIdentifiers as Identifier, | ||
) | ||
from openlineage.client.run import Dataset, InputDataset, OutputDataset | ||
except ImportError: | ||
# When no openlineage client library installed we create no-op classes. | ||
# This allows avoiding raising ImportError when making OL imports in top-level code | ||
# (which shouldn't be the case anyway). | ||
BaseFacet = Dataset = DatasetFacet = InputDataset = OutputDataset = RunFacet = ( | ||
ColumnLineageDatasetFacet | ||
) = Fields = InputField = DocumentationDatasetFacet = ErrorMessageRunFacet = ExternalQueryRunFacet = ( | ||
Error | ||
) = ExtractionErrorRunFacet = LifecycleStateChange = LifecycleStateChangeDatasetFacet = ( | ||
PreviousIdentifier | ||
) = OutputStatisticsOutputDatasetFacet = SchemaDatasetFacet = SchemaDatasetFacetFields = ( | ||
SQLJobFacet | ||
) = Identifier = SymlinksDatasetFacet = create_no_op | ||
|
||
__all__ = [ | ||
"BaseFacet", | ||
"Dataset", | ||
"DatasetFacet", | ||
"InputDataset", | ||
"OutputDataset", | ||
"RunFacet", | ||
"ColumnLineageDatasetFacet", | ||
"Fields", | ||
"InputField", | ||
"DocumentationDatasetFacet", | ||
"ErrorMessageRunFacet", | ||
"ExternalQueryRunFacet", | ||
"Error", | ||
"ExtractionErrorRunFacet", | ||
"LifecycleStateChange", | ||
"LifecycleStateChangeDatasetFacet", | ||
"PreviousIdentifier", | ||
"OutputStatisticsOutputDatasetFacet", | ||
"SchemaDatasetFacet", | ||
"SchemaDatasetFacetFields", | ||
"SQLJobFacet", | ||
"Identifier", | ||
"SymlinksDatasetFacet", | ||
] |
Oops, something went wrong.