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

Adding incremental to the data model #998

Merged
merged 29 commits into from
Nov 18, 2020
Merged

Conversation

cgardens
Copy link
Contributor

@cgardens cgardens commented Nov 16, 2020

What

  • Adds incremental as a concept to the catalog
  • Splits Catalog into a R/O version copy that is emitted by the discover action and a ConfiguredCatalog that contains configuration on how a sync will happen.
  • Maintains "backwards compatibility". As in there is a new struct with a new name but it acts the same as the one it is replacing.
  • This PR just gets all of the configuration to where it needs to be, it does NOT migrate any sources / destinations to incremental.
  • There is especially some more work for whoever tries to figure out the singer <> airbyte catalog conversion for incremental.

Checklist

  • - Builds locally
  • - Integration tests / standard tests pass for all destinations.
  • - Integration tests / standard tests pass for all java sources.
  • - Standard tests pass for some sampling of python and singer sources.
  • - Acceptance tests pass locally
  • - Ready for "final" review. Actually looking to merge this thing.
  • - bump version of every connector to pick up the new model. (done source-postgres and destination-csv to get acceptance tests to pass)

Misc

  • Had to do some refactoring of airbyte_message.yaml and jsonschema validation. will add comments below explaining what's going on.

Please no more requests for name changes in AirbyteCatalog and AirbyteStream

Copy link
Contributor

@jrhizor jrhizor left a comment

Choose a reason for hiding this comment

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

:shipit: I like it overall. Not mergable as-is so I'm just leaving a comment.

Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

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

modulo name comments I think this LGTM. So we are expecting users to configure incremental/full-refresh at the stream level? I think this makes sense. however our current configs expect this to be configured at the connection level so we should adjust our behavior accordingly.

docs/architecture/incremental.md Outdated Show resolved Hide resolved
@@ -0,0 +1,22 @@
# Configuration: Streams & Incremental Syncs

## AirbyteStream
Copy link
Contributor

Choose a reason for hiding this comment

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

Just an idea. It is a bit confusing to use AirbyteCatalog for something that come from the source and something that is fed back to the source.

What about we do (while reusing types):

  • sources produce an AirbyteCatalog which only contains a list of stream
  • sources consume a ConfiguredAirbyteCatalog which contains the list of ConfiguredAirbyteStreams?

This way it is clearer that one is R/O while the other one got some configuration applied to it. ConfiguredAirbyteCatalog should ideally be backward compatible with AirbyteCatalog (not sure how long that can hold) which would mean: sync everything with full refresh.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a bigger change. We can try it though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will try this tomorrow. think it's bigger than i have brain to do now.

Copy link
Contributor Author

@cgardens cgardens Nov 17, 2020

Choose a reason for hiding this comment

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

i think this just changes the project from something that could be done last night to something that'll take a couple days. i think it's better. i had considered doing this but thought it was worth the time since this is the chokepoint for all work on incremental. i'll reallocate folks to other stuff while we massage this. will try this approach today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

implemented this.

docs/architecture/incremental.md Outdated Show resolved Hide resolved
@michel-tricot
Copy link
Contributor

michel-tricot commented Nov 17, 2020 via email

@michel-tricot
Copy link
Contributor

michel-tricot commented Nov 17, 2020 via email

@cgardens
Copy link
Contributor Author

cgardens commented Nov 17, 2020

@michel-tricot - here's the version with catalog and configured catalog split.

working on propagating this throughout the system now.

@cgardens cgardens changed the title RFC: Adding incremental to the data model. Adding incremental to the data model Nov 18, 2020
@@ -40,15 +41,15 @@
// todo (cgardens) - hack, remove after we've gotten rid of Schema object.
public class AirbyteProtocolConverters {

public static AirbyteCatalog toCatalog(Schema schema) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we only ever need to convert from schema into a configured catalog (never the R/O one).

---
"$schema": http://json-schema.org/draft-07/schema#
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-protocol/models/src/main/resources/airbyte_protocol/airbyte_protocol.yaml
title: AirbyteProtocol
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this file needed to be renamed and restructured so that java code gen would pick up the new ConfiguredAirbyteCatalog.

  • The issue is that the codegen starts from the "main" object in the file and generates all of its dependencies. ConfiguredAirbyteCatalog was not a dependency of AirbyteMessage, so it was not being generated.
  • We need ConfiguredAirbyteCatalog in this file because it shares an enum with AirbyteCatalog and the python code gen can't handle structs with dependencies in different files.

* of a JsonSchema file (instead of the main object in that file).
* @return schema object processed from across all dependency files.
*/
public static JsonNode getSchema(final File schemaFile, String definitionStructName) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing the structure of the airbyte_message / airbyte_protocol file means that we need to get the schema from an object that is not the main object in the jsonschema file. So needed to rejigger this internal lib to handle the case where we want to put the jsonschema of an object defined in "definitions" instead of the main file.

@@ -41,6 +41,6 @@
* will always be called once regardless of success or failure.
* @throws Exception - any exception.
*/
DestinationConsumer<AirbyteMessage> write(JsonNode config, AirbyteCatalog catalog) throws Exception;
DestinationConsumer<AirbyteMessage> write(JsonNode config, ConfiguredAirbyteCatalog catalog) throws Exception;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks so much better!

@michel-tricot
Copy link
Contributor

Terrific!

@cgardens
Copy link
Contributor Author

cool. going to start pushing new images then!

@cgardens cgardens force-pushed the cgardens/incremental_model branch from 1b0b7c0 to 80d956a Compare November 18, 2020 21:40
@cgardens cgardens merged commit e7edb2c into master Nov 18, 2020
@cgardens cgardens deleted the cgardens/incremental_model branch November 18, 2020 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants