-
Notifications
You must be signed in to change notification settings - Fork 4.6k
🐙 octavia-cli: add generate for connections #10809
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
Conversation
from airbyte_api_client.model.source_id_request_body import SourceIdRequestBody | ||
|
||
|
||
class Connection: |
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.
Sorry but I've a strong refacto suggestion 😄 :
- I think that the class you describe here is not a
Connection
but aCatalog
- I think that catalog should be attributes of sources (in the API
discover_schema
is called within thesource
endpoint:/v1/sources/discover_schema
) - In the
octavia apply
PR I created Source objects (here) - My suggestion is to add a
catalog
attribute to the Source and publically expose this attribute, enabling this kind of interactions:
my_source = Source(api_client, ...)
my_source.catalog.streams
This will be a way to explicitly declare the dependency between a source (or destination) existence before generating the connection YAML file.
I think this also can lead to the following change of your command function (octavia generate connection
):
octavia generate connection --source ./path/to/my/source.yaml --destination ./path/to/my/destination.yaml my_connection_name
The command will do something like:
import octavia_cli.apply.resources
source = resources.factory(api_client, workspace_id, source_file_path)
destination = resources.factory(api_client, workspace_id, destination_file_path)
if not (source.was_created and destination.was_created):
raise resources.NonExistingRessourceError("...")
connection_renderer = ConnectionRenderer(connection_name, source.resource_id, destination.resource_id, source.catalog.streams)
connection_renderer.write_yaml(".")
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.
Gotcha! Makes sense
@click.argument("source_id", type=click.STRING) | ||
@click.argument("destination_id", type=click.STRING) |
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 think that this command should rather take the source and destination YAML file path. I explain why in my next comment :)
name: {{ resource_name }} | ||
source_id: {{ source_id }} | ||
destination_id: {{ destination_id }} |
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.
name: {{ resource_name }} | |
source_id: {{ source_id }} | |
destination_id: {{ destination_id }} | |
resource_name: mock_connection | |
definition_type: connection | |
source_id: mock_source | |
destination_id: mock_destination | |
Could you please try to mimic the top of the other template?
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.
Maybe we can create template composition with Jinja to make source_or_destination.yaml.j2
and connection.yaml.j2
share the same headers.
What
Describe what the change is solving
It helps to add screenshots if it affects the frontend.
How
Describe the solution
Recommended reading order
x.java
y.python
🚨 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/SUMMARY.md
docs/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.