-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Lightweight export/import of configurations scoped by workspace Id #5598
Conversation
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 not having tests for these new methods/class makes me super nervous. Could we add those?
.collect(Collectors.toList()); | ||
writeConfigsToArchive(parentFolder, ConfigSchema.SOURCE_CONNECTION.name(), sourceConnections.stream().map(Jsons::jsonNode)); | ||
|
||
final Map<UUID, StandardSourceDefinition> sourceDefinitionMap = new HashMap<>(); |
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.
this method is formidable. can we break it up a little? are there any DRY opportunities here?
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.
Yes, I just got the basic functionality working, I'll refactor parts and add tests now
return dump; | ||
} | ||
|
||
private void exportConfigsDatabase(Path parentFolder, UUID workspaceId) throws IOException, JsonValidationException, ConfigNotFoundException { |
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.
at a high level it feels like there should be an export(list<uuid> workspaceIds)
instead of having two different implementations one scoped by workspace. Would that make sense here or am I missing something?
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.
This export function scoped by workspace Id is exporting configurations related to a workspace and then "cascade" down to other configurations that are being referred/dependent on them.
The second export without scope is dumping everything regardless of links/relations between configurations and thus, will cover more configurations than this export(uuid)
or a export(list<uuid>)
function
final Stream<T> configs = readConfigsFromArchive(sourceRoot, configSchema); | ||
if (!dryRun) { | ||
switch (configSchema) { | ||
case STANDARD_SOURCE_DEFINITION -> importStandardSourceDefinitionsIntoWorkspace(configs); |
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.
How are we going to handle this on cloud now?
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 still need to introduce a wrapped version of this that changes the behavior in cloud
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 the moment, i'm thinking about adding a different configDumpImporter that ignores all standard definitions for the short term (since we don't allow custom connectors yet)
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.
// 1. Unzip source | ||
Archives.extractArchive(archive.toPath(), sourceRoot); | ||
|
||
// TODO: Auto-migrate archive? |
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 have thought about the archive auto migration feature. It will be a medium size project. We need to write version-specific importer that can understand imports of different versions.
Issue here: #5682
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpExporter.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpImporter.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpImporter.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpImporter.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpImporter.java
Outdated
Show resolved
Hide resolved
// We sort the directories because we want to process SOURCE_CONNECTION after | ||
// STANDARD_SOURCE_DEFINITION and DESTINATION_CONNECTION after STANDARD_DESTINATION_DEFINITION | ||
// so that we can identify which definitions should not be upgraded to the latest version | ||
directories.sort(Comparator.reverseOrder()); |
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.
Since we don't update the definition in this method, the sorting here seems unnecessary.
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.
we update definitions when its a new definition to create.
This should be done before importing the connector as it checks that definitions exists first
What
Describe what the change is solving
Closes #5124
How
Describe the solution
Recommended reading order
airbyte-api/src/main/openapi/config.yaml
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpExporter.java
airbyte-server/src/main/java/io/airbyte/server/ConfigDumpImporter.java
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
docs/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
docs/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 changes