-
Notifications
You must be signed in to change notification settings - Fork 427
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
fix: wildcards in database name #1666
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integration tests failure for 1c5a7735bf8d0aa016bce0f8eaa3c5cd0e06f323 |
Integration tests failure for 67a12b36069653b9acedf65c0ce5d8a0a81fa9f8 |
Integration tests failure for db18992b3c1aa773f583b09d5ee8a27e9b782333 |
Integration tests failure for 1d1edd18dfb6911ad3ff3f60e83623a9b0b6b2ef |
Integration tests success for f0f265e4153dff6a593240d90fdd56a15fff4596 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the bug
Issue with two databases due to their names since the query used by Terraform (SHOW DATABASES LIKE '') returns more than one value generating a Terraform plan with unexpected replacements (image attached)
Expected behavior
It should be presenting 1 result instead of 2 .
Code samples and commands
SHOW DATABASES LIKE ''; --return 2 rows
Additional context
Customer wants Snowflake to enhance the terraform script.
The underscore wild card is SQL standard, and works in oracle, mysql, sql server and postegresql .They are not willing to change the database name but rather wants us to make the Terraform script changes.They want to make Terraform provider for Snowflake, wildcard proof.
SQL wildcards are supported in pattern:
An underscore (_) matches any single character.
A percent sign (%) matches any sequence of zero or more characters.
Wildcards in pattern include newline characters (\n) in subject as matches.
LIKE pattern matching covers the entire string. To match a sequence anywhere within a string, start and end the pattern with %.
We asked customer to use account_usage.databases view or information_schema.databases view, and filter by the DATABASE_NAME='dbname'.
SHOW DATABASE is doing "LIKE" condition and querying the account_usage.databases view where DATABASE_NAME='dbname' will provide the exact match.
The above suggestion was rejected since the same query cannot be injected into Terraform’s source cod