Snowflake-Labs / schemachange

A Database Change Management tool for Snowflake
Apache License 2.0
481 stars 219 forks source link

dry-run flag not working #177

Open ramandatascientist opened 1 year ago

ramandatascientist commented 1 year ago

Hello Everyone

We are trying to run schemachange using dry-run=true flag but its not working. It only list the .SQL files that it will run but does not compile the file to show any SQL compilation or permissions errors in dry run mode

is this expected or a bug?

sfc-gh-tmathew commented 9 months ago

Hello @ramandatascientist

Thank you for reaching out.

the dry-run flag is to check if files have the minimum version number or not. The actual SQL statement is not executed on the database until the dry-run flag is excluded from the command line. It is working as designed.

Each sql file is executed separately and will need a separate version number if you follow the currently documented pattern of executing the SQL files in a single run. So if there was an error in syntax or permissions, schemachange will fail the execution at the first error in a SQL file.

If you look at #110, you could potentially run one of the approaches on a cloned database before pushing the code through devops pipeline to actually execute the batch of SQL files you intend to run.

Thoughts?