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

Move common implementation to base implementation #33369

Merged
merged 12 commits into from Dec 13, 2023
Merged

Conversation

gisripa
Copy link
Contributor

@gisripa gisripa commented Dec 12, 2023

What

Promotes common implementation to base class and redshift specific overrides.
Anything jooq supports with dialect specific syntax is moved to JdbcSqlGenerator.
Breaking CDK changes.

Closes #31591

@gisripa gisripa requested a review from a team as a code owner December 12, 2023 20:38
Copy link

vercel bot commented Dec 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2023 10:00pm

@octavia-squidington-iii octavia-squidington-iii added area/connectors Connector related issues CDK Connector Development Kit connectors/destination/redshift labels Dec 12, 2023
Copy link
Contributor

github-actions bot commented Dec 12, 2023

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.


protected abstract Condition cdcDeletedAtNotNullCondition();

protected abstract Field<Integer> getRowNumber(final List<ColumnId> primaryKey, final Optional<ColumnId> cursorField);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

jooq already handles dialect specific rowNumber() window step function but the additional support of DESC NULLS FIRST|LAST is missing (which redshift and snowflake does). so, made it abstract

@edgao
Copy link
Contributor

edgao commented Dec 12, 2023

is it possible to extract a JdbcSqlGeneratorIntegrationTest class? I feel like that's the last piece missing (and also huge leverage, iirc implementing the redshift version took nearly 2 days)

@gisripa
Copy link
Contributor Author

gisripa commented Dec 12, 2023

is it possible to extract a JdbcSqlGeneratorIntegrationTest class? I feel like that's the last piece missing (and also huge leverage, iirc implementing the redshift version took nearly 2 days)

I think so, I'll take a look. expected fixtures will still be destination specific but some of the setup/teardown code can go to this class.

Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

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

took a quick pass over this. Left a few comments but didn't read the sqlgenerators in great detail. I think this is really great though, love that everything in RedshiftSqlGenerator is actually redshift-specific now ❤️

will do another pass later but I think this is enough for me to write up some tickets for mysql :)

if (!force) {
return Strings.join(
List.of(
createSchemaSql(stream.id().finalNamespace()),
Copy link
Contributor

Choose a reason for hiding this comment

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

(nonblocking) this will need to be refactored after @jbfbell 's #33124, but should be a pretty easy change.

import org.jooq.meta.TableDefinition;

public abstract class JdbcSqlGeneratorIntegrationTest<T> extends BaseSqlGeneratorIntegrationTest<T> {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@edgao Moved reusable methods to base class. Thing to be noted is typing-deduping doesn't depend on CDK so i had to leave it generic type. I think these methods should be moved to a Util rather than a base test class in later refactors.

Copy link
Contributor

Choose a reason for hiding this comment

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

we could put this into db-destinations.testFixtures?

Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

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

approving just so we can get this thing merged, but we probably should add the useExpensiveSaferCasting logic soonish

private String insertAndDeleteTransaction(final StreamConfig streamConfig,
final String finalSuffix,
final Optional<Instant> minRawTimestamp,
final boolean useExpensiveSaferCasting) {
Copy link
Contributor

Choose a reason for hiding this comment

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

intellij says this param isn't being used?

@gisripa
Copy link
Contributor Author

gisripa commented Dec 13, 2023

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/7201193180
❌ Publish Java CDK version=0.7.2 failed!

Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
…dbc sqls

Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
@gisripa
Copy link
Contributor Author

gisripa commented Dec 13, 2023

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/7201359317
✅ Successfully published Java CDK version=0.7.3!

Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
@gisripa gisripa merged commit 4cec594 into master Dec 13, 2023
21 checks passed
@gisripa gisripa deleted the gireesh/jdbc_v2 branch December 13, 2023 22:33
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation CDK Connector Development Kit checklist-action-run connectors/destination/redshift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Destinations V2: genericize JDBC code
3 participants