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

Write a temporary table to verify write permissions when checking destination JDBC credentials #1834

Merged
merged 7 commits into from
Jan 26, 2021

Conversation

sherifnada
Copy link
Contributor

@sherifnada sherifnada commented Jan 26, 2021

What

Closes #1772

Enhance the check method for JDBC destinations by creating & dropping a temporary table. The "correct" way to do this should be to write DB-specific queries (e.g to check the right metadata tables) that don't incur any side-effects, but getting this in for the upcoming release, then we can revisit.

Pre-merge checklist

  • bump connector versions & publish

@sherifnada sherifnada linked an issue Jan 26, 2021 that may be closed by this pull request
@sherifnada
Copy link
Contributor Author

sherifnada commented Jan 26, 2021

/test connector=destination-bigquery

🕑 destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/510815837
✅ destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/510815837

@sherifnada
Copy link
Contributor Author

sherifnada commented Jan 26, 2021

/test connector=destination-snowflake

🕑 destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/510816186
✅ destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/510816186

@sherifnada
Copy link
Contributor Author

sherifnada commented Jan 26, 2021

/test connector=destination-postgres

🕑 destination-postgres https://github.com/airbytehq/airbyte/actions/runs/510816315
✅ destination-postgres https://github.com/airbytehq/airbyte/actions/runs/510816315

@sherifnada
Copy link
Contributor Author

sherifnada commented Jan 26, 2021

/test connector=destination-redshift

🕑 destination-redshift https://github.com/airbytehq/airbyte/actions/runs/510816813
✅ destination-redshift https://github.com/airbytehq/airbyte/actions/runs/510816813

String outputTableName = "_airbyte_connection_test_" + UUID.randomUUID().toString().replaceAll("-", "");
sqlOperations.createSchemaIfNotExists(database, outputSchema);
sqlOperations.createTableIfNotExists(database, outputSchema, outputTableName);
sqlOperations.dropTableIfExists(database, outputSchema, outputTableName);
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need to drop the schema too?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh i guess sql operations doesn't have this.

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 wouldn't wnat to drop the schema if it already existed

Copy link
Contributor

Choose a reason for hiding this comment

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

ignore this. i thought this was a test schema.

Copy link
Contributor

@michel-tricot michel-tricot left a comment

Choose a reason for hiding this comment

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

Cool!

Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

i am really not a big fan of there being a side effect to a check connection. talked through this with @sherifnada, i'm convinced that there's not a great way of getting this information out of the metadata provided by jdbc. assuming that we don't want to write custom code for each db, this seems like the only way we can verify that the destination will be able to create tables in the target schema. i think i'm convinced that this is something worth checking at check connection and will generally make a user's life better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snowflake check does not verify permissions correctly
4 participants