-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[low code connectors] read configs from package_data #15810
Conversation
@@ -65,9 +66,11 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: | |||
return [self._factory.create_component(stream_config, config, True)() for stream_config in self._stream_configs()] | |||
|
|||
def _read_and_parse_yaml_file(self, path_to_yaml_file): | |||
with open(path_to_yaml_file, "r") as f: |
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.
open() only works running locally and I am not sure how. this passes SAT, something we should follow up on. But replacing this with how we read spec files fixes the issue as long as we mount the package files in the connectors setup.py
@@ -39,7 +39,7 @@ def check_connection(self, source: Source, logger: logging.Logger, config: Mappi | |||
records = stream.read_records(sync_mode=SyncMode.full_refresh) | |||
next(records) | |||
except Exception as error: | |||
return False, f"Unable to connect to stream {stream} - {error}" | |||
return False, f"Unable to connect to stream {stream_name} - {error}" |
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.
for declarative yaml files we end up printing the entire yaml config in the UI which is pretty ugly and makes it hard to see the real error message
* read configs from package_data * update changelog and setup * commenting out failing tests in the short term
What
additional fix for https://github.com/airbytehq/oncall/issues/462
yaml_declarative_source.py
is not properly reading files when running in a container. The working directory during an operation is not structured the same as the static files. Instead for each connector insetup.py
we need to import yaml files so they can be used at runtime. And we can only access them usingpkgutil.get_data()
. This is the same way that read spec.yaml and spec.json files.I tested this on a locally running instance of Airbyte. After this change goes out, we need to update all 3 connectors to the latest version of the CDK and add
*.yaml
to setup.py and change the path_to_yaml tosentry.yaml
or whatever source we're fixing.How
Replace the existing
open()
command that only works locally with a file reader frompkgutil