Skip to content
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

[#14361] Adding new generator for configuration based source template #14887

Merged
merged 5 commits into from
Jul 21, 2022

Conversation

brianjlai
Copy link
Contributor

@brianjlai brianjlai commented Jul 20, 2022

What

Add a new template to ./generator.sh that allows developers to instantiate a new configuration based source connector. This automatically generates the source yaml parser and a limited set of components to get a basic connector working.

  • a single stream
  • basic schema_loader
  • a requester with no pagination defined
  • mocked out authentication, url_base, primary_key, path, and record selector

After generating the boilerplate, the remaining requirements for the implementer are as follows:

  • Implement spec.yaml
  • Add stream schemas to /schemas
  • Adding testing config.json
  • Replace url_base, token, path

How

Adapts the existing http-source generator, but the key areas it diverges is in how source.py is implemented in order to parse a YAML file into a fully functioning source that adheres to the CDK interface. It also defines the baseline YAML config.

Recommended reading order

  1. plopfile.js
  2. source.py.hbs
  3. {{snakeCase name}}.yaml.hbs
  4. README.md.hbs
  5. schemas/TODO.md.hbs
  6. I also fixed a few small CDK things to make the template cleaner

@github-actions github-actions bot added the CDK Connector Development Kit label Jul 20, 2022
…es that aren't relevant to config based connectors
@brianjlai brianjlai requested a review from girarda July 20, 2022 16:22
@brianjlai brianjlai marked this pull request as ready for review July 20, 2022 16:22
@brianjlai brianjlai requested a review from a team as a code owner July 20, 2022 16:22
from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1.64",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to always get the latest version when running the generator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want the latest bumps in major versions too? The ~= should continue to get the latest patch. I can see extending this out to the minor version, but we may still want to be restrictive against getting the latest when theres a major version bump.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to freeze the requirements, but i would expect the generator to create a connector using the latest version of the cdk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking into it a bit, it is possible since we could parse the cdk's setup.py file to find the latest, but I don't see a great way of doing that. maybe some derivative of using the setuptools package, but that normally gets the current working version. Not super blocking so I'm gonna move forward with merging it in.

@brianjlai brianjlai merged commit 2a8d251 into master Jul 21, 2022
@brianjlai brianjlai deleted the brian/declarative_setup_templates branch July 21, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants