Repository navigation
🐛 Snowflake destination: do not create schema if it exists - #9311
oneshcheret (sashaNeshcheret) merged 7 commits into
Conversation
|
/test connector=connectors/destination-snowflake
|
Eugene (etsybaev)
left a comment
There was a problem hiding this comment.
- Please do not forget to update the changelog, bump versions and release new images
- Pass all PR's checklists
- Is there any way to create a test for it?
Thanks
…nowflake-do-not-create-schema-if-exists
Unfortunately we cannot add test for this case, i found two case: first is create user with usage permissions on database level, but we cannot do it with integration test user, do not have enough privileges for it. Second way is to revoke 'create schema' privileges from integration test user, run check and than grant it again, we can do revoking, but for grant we need ownership privileges, but it can be granted only to one role. |
|
we can proceed with publish and merge without airbyte review |
|
/test connector=connectors/destination-snowflake
|
|
/publish connector=connectors/destination-snowflake
|
|
/publish connector=connectors/destination-snowflake
|
…nowflake-do-not-create-schema-if-exists # Conflicts: # airbyte-config/init/src/main/resources/seed/destination_definitions.yaml # airbyte-integrations/connectors/destination-snowflake/Dockerfile # docs/integrations/destinations/snowflake.md
|
/test connector=connectors/destination-snowflake
|
|
/test connector=connectors/destination-snowflake
|
…nowflake-do-not-create-schema-if-exists
|
/test connector=connectors/destination-snowflake
|
|
/publish connector=connectors/destination-snowflake
|
| * | ||
| * @return true if the schema exists in destination database, false if it doesn't | ||
| */ | ||
| default boolean isSchemaExists(final JdbcDatabase database, final String schemaName) throws Exception { |
There was a problem hiding this comment.
does snowflake not have a SQL statement IF NOT EXISTS? e.g: CREATE SCHEMA IF NOT EXISTS %s;? why is the iface method needed?
Ifyes, can you leave a comment clarifying why this method is needed?
Also, why do we need an extra method? Shouldn't it be covered by the createSchemaIfNotExists method? Having a default implementation which returns true can also be misleading for the developer. Either it is required or we should embed this inside createSchemaIfNotExists
There was a problem hiding this comment.
There was a problem hiding this comment.
Sherif A. Nada (@sherifnada) snowflake has a SQL statement IF NOT EXISTS and it was replaced by the changes. The cause for it is the 'create schema' statement needs 'CREATE SCHEMA', 'OWNERSHIP' or 'ALL' permissions on database level, and users with existing schema and 'Using' permissions on database level faced with issue Could not connect with provided configuration. SQL access control error: Insufficient privileges to operate on database 'DATABASE.
So instead of simply call CREATE SCHEMA IF NOT EXISTS %s; we firstly need to check it and try to create only if schema is absent.
Regarding right place, i did it common interface because theoretically we can faced with same permissions behavior in other db, for now i will move it from interface to snowflake operations impls.
What
Allow Airbyte to write to the existing Snowflake Schema without database ownership
How
We need to check whether schema already exist before trying to create it. Fix is applicable for all snowflake insert methods
Recommended reading order
x.java🚨 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.mdbootstrap.md. See description and examplesdocs/SUMMARY.mddocs/integrations/<source or destination>/<name>.mdincluding changelog. See changelog exampledocs/integrations/README.mdairbyte-integrations/builds.mdAirbyter
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./publishcommand described hereUpdating a connector
Community member or Airbyter
airbyte_secret./gradlew :airbyte-integrations:connectors:<name>:integrationTest.README.mdbootstrap.md. See description and examplesdocs/integrations/<source or destination>/<name>.mdincluding 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./publishcommand described hereConnector Generator
-scaffoldin their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplatesthen checking in your changes