Skip to content

πŸ› Destination snowflake: Handle namespace/stream name/columns containing ${ - #30416

Merged
Edward Gao (edgao) merged 6 commits into
masterfrom
edgao/dv2/snowflake/escaping
Sep 14, 2023
Merged

Edward Gao (edgao) merged 6 commits into
masterfrom
edgao/dv2/snowflake/escaping

Conversation

@edgao

@edgao Edward Gao (edgao) commented Sep 13, 2023 •

Copy link
Copy Markdown
Contributor

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 Cynthia Yin (@cynthiaxyin) 's 9b1d1f5#diff-e6c24d3a3e554cd6197d2bc046dcf7b1926e25d01fdae9108b7a56fe306d8e91 :(

@github-actions

github-actions Bot commented Sep 13, 2023 •

Copy link
Copy Markdown
Contributor

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
Edward Gao (edgao) marked this pull request as ready for review September 13, 2023 22:42
@edgao
Edward Gao (edgao) requested a review from a team as a code owner September 13, 2023 22:42
@octavia-squidington-iii Octavia Squidington III (octavia-squidington-iii) added the area/documentation Improvements or additions to documentation label Sep 13, 2023
@edgao Edward Gao (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
Copy Markdown
Contributor

bigram - today I learned!

@evantahler

Copy link
Copy Markdown
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

@evantahler Evan Tahler (evantahler) left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

Evan Tahler (@evantahler) I added some commits which are individually reviewable, PTAL

@github-actions

Copy link
Copy Markdown
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

@evantahler Evan Tahler (evantahler) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

βœ”οΈ

@edgao
Edward Gao (edgao) merged commit 70ef3b4 into master Sep 14, 2023
@edgao
Edward Gao (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