-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
get module name from sys.modules #17779
Conversation
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.
a few small things, but don't need to block on approval
# the connector's module name can be inferred by looking at the modules loaded and look for the one starting with source_ | ||
source_modules = [ | ||
k for k, v in sys.modules.items() if "source_" in k | ||
] # example: ['source_exchange_rates', 'source_exchange_rates_tutorial.source'] |
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.
I'm a little confused by your comment example here. Are you saying that the result of one sys.modules
call will result in these two items in the map? Or that these are two possible permutations of how the sys.modules
call will be returned (one called from the source_exchange_rates
source and one called from the source_exchange_rates_tutorial
source)?
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.
fixed the comment. thanks!
source_modules = [ | ||
k for k, v in sys.modules.items() if "source_" in k | ||
] # example: ['source_exchange_rates', 'source_exchange_rates_tutorial.source'] | ||
module = source_modules[0].split(".")[0] |
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.
If a developer went out of their way to name their modules incorrectly w/o source_
, this would crash. More of a user error to deviate from the template, but we should check here and throw an error instead of crashing. I'm sure other things would fail if they did that as well, but just in case
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.
done
/publish-cdk dry-run=false
|
* get module name from sys.modules * bump * fix comment * throw exception * fix unittests * Add missing files * remove debug prints * indent
What
This is a fix for #17772.
Acceptance tests don't run from the same main file as running the discovery command.
Instead of inferring the connector's module from the main file, we can get it from the list of modules that are loaded in the environment at runtime
How
Recommended reading order
airbyte-cdk/python/airbyte_cdk/sources/declarative/schema/json_schema.py
Testing
Testing cdk changes is tedious. I used the following script with the following docker image to run the SATs using this branch
dockerfile:
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.