-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make openlineage
an optional dependency
#1252
Conversation
Codecov ReportBase: 94.13% // Head: 94.13% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #1252 +/- ##
=======================================
Coverage 94.13% 94.13%
=======================================
Files 17 17
Lines 597 597
Branches 67 67
=======================================
Hits 562 562
Misses 22 22
Partials 13 13 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
try: | ||
from openlineage.client.facet import ( | ||
BaseFacet, | ||
DataQualityMetricsInputDatasetFacet, | ||
DataSourceDatasetFacet, | ||
OutputStatisticsOutputDatasetFacet, | ||
SchemaDatasetFacet, | ||
SchemaField, | ||
SqlJobFacet, | ||
) | ||
from openlineage.client.run import Dataset as OpenlineageDataset | ||
except ImportError: | ||
logging.warning("Install openlineage-airflow") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't like the try..except
in all the modules, since it is used everywhere.. We can just try to import it once in some common module, and use that.
try: | ||
from openlineage.client.facet import BaseFacet, DataSourceDatasetFacet, SchemaDatasetFacet, SchemaField | ||
from openlineage.client.run import Dataset as OpenlineageDataset | ||
except ImportError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 21 still will import openlineage library
openlineage
an optional dependency
I have pushed a different way of handling this in a896896 |
a896896
to
e443428
Compare
has_openlineage = True | ||
except ImportError: | ||
has_openlineage = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have these? If we are not using them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not use has_openlineage
in the other modules to decide if we want to import or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
Can we not use has_openlineage in the other modules to decide if we want to import or not?
yeah, just another way -- no strong opinion
e443428
to
13e0ed4
Compare
Description
What is the current behavior?
We shouldn’t import the openlineage package at top level if it is optional.
Refer to https://astronomer.slack.com/archives/C02B8SPT93K/p1668186729410429
closes: #1243
What is the new behavior?
Does this introduce a breaking change?
No
Checklist