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

🐛 Destination snowflake: Handle namespace/stream name/columns containing ${ #30416

Merged
merged 6 commits into from Sep 14, 2023

Conversation

edgao
Copy link
Contributor

@edgao edgao commented Sep 13, 2023

closes #30391

The underlying problem is that EXECUTE IMMEDIATE throws an error if you have a string or identifier containing the ${ bigram in your script block. Make two changes to support this:

  • ${ is now replaced by __ (double underscore) in table, schema, and column names
    • This is not a breaking change - previously this was crashing the sync; now the sync no longer crashes
  • There's a massive hack in the PK validation code to support this

For the original issue, this means we'll end up with a column "__meta_ads}"... do we want to also turn that final } into an underscore?

Notably: there's now a distinction between escapeJsonIdentifier and escapeSqlIdentifier, because we still need to query the raw data as "_airbyte_data":"${foo}". This will be a merge conflict with @cynthiaxyin 's 9b1d1f5#diff-e6c24d3a3e554cd6197d2bc046dcf7b1926e25d01fdae9108b7a56fe306d8e91 :(

@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 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.

@edgao edgao marked this pull request as ready for review September 13, 2023 22:42
@edgao edgao requested a review from a team as a code owner September 13, 2023 22:42
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Sep 13, 2023
@edgao edgao changed the title Destination snowflake: Handle namespace/stream name/columns containing ${ 🐛 Destination snowflake: Handle namespace/stream name/columns containing ${ Sep 13, 2023
@evantahler
Copy link
Contributor

bigram - today I learned!

@evantahler
Copy link
Contributor

For the original issue, this means we'll end up with a column "__meta_ads}"... do we want to also turn that final } into an underscore?

If it's not difficult, yes I'd say to remove the final }, but don't spend too much time on it

Copy link
Contributor

@evantahler evantahler left a comment

Choose a reason for hiding this comment

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

There probably should be a test for a column with a ${} too

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@edgao
Copy link
Contributor Author

edgao commented Sep 13, 2023

@evantahler I added some commits which are individually reviewable, PTAL

@github-actions
Copy link
Contributor

destination-snowflake test report (commit b9b0c388b7) - ✅

⏲️ Total pipeline duration: 14mn40s

Step Result
Java Connector Unit Tests
Build connector tar
Build destination-snowflake docker image for platform linux/x86_64
Java Connector Integration Tests
Validate airbyte-integrations/connectors/destination-snowflake/metadata.yaml
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=destination-snowflake test

Copy link
Contributor

@evantahler evantahler left a comment

Choose a reason for hiding this comment

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

✔️

@edgao edgao merged commit 70ef3b4 into master Sep 14, 2023
24 checks passed
@edgao edgao deleted the edgao/dv2/snowflake/escaping branch September 14, 2023 15:17
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 connectors/destination/snowflake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interpolation Error on Snowflake Custom Namespace
3 participants