* method yielding airbytemessage * move to Stream * update abstract source * reset * missing file * Yield request and response as log messages * only emit request and responses if the debug flag is on * add test docker image * script to run acceptance tests with local cdk * Update conftest to use a different image * extract to method * dont use a different image tag * Always install local cdk * break the cdk * get path from current working directory * or * ignore unit test * debug log * Revert "AMI change: ami-0f23be2f917510c26 -> ami-005924fb76f7477ce (#18689)" This reverts commitbf06decf73. * build from the top * Update source-acceptance-test * fix * copy setup * some work on the gradle plugin * reset to master * delete unused file * delete unused file * reset to master * optional argument * delete dead code * use latest cdk with sendgrid * fix sendgrid dockerfile * break the cdk * use local file * Revert "break the cdk" This reverts commit600c195541. * dont raise an exception * reset to master * unit tests * missing test * more unit tests * remove deprecated comment * newline * reset to master * remove files * reset * Update abstract source * remove method from stream * convert to airbytemessage * unittests * Update * unit test * remove debug logs * Revert "remove debug logs" This reverts commita1a139ef37. * Revert "Revert "remove debug logs"" This reverts commitb1d62cdb60. * Revert "reset to master" This reverts commit3fa6a004c1. * fix * slightly better test * typing * extract method * Revert "Revert "reset to master"" This reverts commit5dac7c2804. * reset to master * reset to master * Revert "reset to master" This reverts commit3fa6a004c1. * Comment * operate on the message * Revert "Revert "reset to master"" This reverts commit5833c84d0a. * comment * test * Revert "test" This reverts commit2f91b803b0. * test * Revert "test" This reverts commit62d95ebbb5. * test * Revert "test" This reverts commit27150ba341. * format * format * symlink * Update setup * update path * reset to master * update * Add local files * greenhouse * format * symlink * try reordering * better error message * better log message * reset to master * Revert "merge for qa" This reverts commitad7128f2c5, reversing changes made to7196c22a73. * reset to master * reset to master * reset to master * format * gradlew format * right type hints * reset to master * reset to master * gradlew format * a bunch of small fixes * Update output format * fixes from feedback * fixme comment * streams cannot return AirbyteRecordMessage * fix * format * only return logs when running on debug mode * move branching * update typing * remove dead code * fix simpleretriever name * i think this is better * log response.text * debug flag * comment * pass config * comments * run SATs * fix most of the unit tests * fix unit test * reset to master * runFromPath * Revert "runFromPath" This reverts commit85979a801a. * Revert "run SATs" This reverts commita8a8a2da95. * no need to convert to dict * fix test
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
#
|
|
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
|
|
#
|
|
|
|
import pkgutil
|
|
|
|
from airbyte_cdk.sources.declarative.manifest_declarative_source import ManifestDeclarativeSource
|
|
from airbyte_cdk.sources.declarative.parsers.yaml_parser import YamlParser
|
|
from airbyte_cdk.sources.declarative.types import ConnectionDefinition
|
|
|
|
|
|
class YamlDeclarativeSource(ManifestDeclarativeSource):
|
|
"""Declarative source defined by a yaml file"""
|
|
|
|
def __init__(self, path_to_yaml, debug: bool = False):
|
|
"""
|
|
:param path_to_yaml: Path to the yaml file describing the source
|
|
"""
|
|
self._path_to_yaml = path_to_yaml
|
|
source_config = self._read_and_parse_yaml_file(path_to_yaml)
|
|
super().__init__(source_config, debug)
|
|
|
|
def _read_and_parse_yaml_file(self, path_to_yaml_file) -> ConnectionDefinition:
|
|
package = self.__class__.__module__.split(".")[0]
|
|
|
|
yaml_config = pkgutil.get_data(package, path_to_yaml_file)
|
|
decoded_yaml = yaml_config.decode()
|
|
return YamlParser().parse(decoded_yaml)
|
|
|
|
def _emit_manifest_debug_message(self, extra_args: dict):
|
|
extra_args["path_to_yaml"] = self._path_to_yaml
|
|
self.logger.debug("declarative source created from parsed YAML manifest", extra=extra_args)
|