-
Notifications
You must be signed in to change notification settings - Fork 228
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
Configure Snowflake Schema via Config #210
Configure Snowflake Schema via Config #210
Conversation
* Update issue templates: Bug Report, Questions and Enhancement templates
Initial workflow for contributing to schemachange repository
…for_contribution Adding Contribution guidelines
0af9a68
to
58dfded
Compare
@podung we will review it and run some tests before merging the PR for the next release. Thank you for your contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I thought schema was here already!
Appreciate your time in review and being willing to accept this PR. Thanks for the library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, hit approved too quickly. See comment below, but we're missing the version number change and CHANGELOG entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested the changes, but the core changes look good. We do need to update the version number and the CHANGELOG still.
16bb5ee
to
b0285bf
Compare
Done. Thanks again and let me know if I can do anything else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now. We will run some tests before merging the code into 3.6.1 release
We will test before merging but the changes so far look good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
* Update issue templates (#206) * Update issue templates: Bug Report, Questions and Enhancement templates * Create CONTRIBUTING.md Initial workflow for contributing to schemachange repository * Add support for specifying the schema via config * Documentation: Include details on configuring the default schema * Updated version and changelog --------- Co-authored-by: podung <joe.depung@gmail.com> Co-authored-by: Tyler White <90005851+sfc-gh-twhite@users.noreply.github.com>
NOTE: Original PR and discussion is here: #180. The following description is pasted from that original PR
I'd like the ability to optionally specify the
snowflake_schema
via config.Example of Problematic Script
Schemachange Error
Explanation
The
schemachange
docs specifyFor most objects, it is sufficient to just declare the db name and schema name in the proc / function / table declaration. However some objects (namely SQL UDTFs in this example) in snowflake seem to ensure the object can compile. Since a schema is not provided on the
SELECT ... FROM CUSTOMER
statement, and noUSE SCHEMA
directive has been set, the error occurs.Work-Arounds
In the UDTF, a fully qualified name can be given (e.g.
Select ... FROM {{ db_name }}.{{ schema_name }}.CUSTOMER
).In the migration, before the CREATE OR REPLACE directive, we can simply add the statement
USE SCHEMA {{ schema_name }};
Why this change is useful
Our team has a requirement to keep the object DDLs identical in each environment (Dev, test, prod, etc). There are a few instances where snowflake requires fully qualified object names to verify compilation during object creation (namely: SQL UDTFs). Instead of having to add the
USE SCHEMA {{ schema_name }};
directive in many of our migration files, we'd like to just supply the schema up front and haveschemcachange
execute the statement for us at the beginning of the run.PR Tasks
If you are interested in this PR I would be happy to complete the above tasks. Thanks for the library and for the consideration.