All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Updated
snowflake-connector-python
dependency to version 2.8. This should address errors with result batching in thefetch_r_script_checksum
method when users have a lot of scripts in their project.
- Added a new optional parameter
--query-tag
to append a string to the QUERY_TAG that is attached to every SQL statement executed
- Added filtering of secrets when vars are displayed on the console.
- Added filtering of secrets for deploy command when SQL statements are displayed as part of verbose output.
- Changed vars to be pretty printed to the console.
- Changed demo citibike_jinja to demonstrate secret filtering.
- Updated the Jinja templating engine section of the README.md to document Jinja autoescaping status and added warning about untrusted input.
- Updated the table of contents section of the README.md to included missing sections.
- Added
env_var
Jinja function support to migration templates. - Backed out Jinja autoescape change from 3.3.2. The default is now to have it disabled (using autoescape=False).
- Configured Jinja to escape inputs to templates (using autoescape=True). This helps protect rendered templates against XSS and other vulnerabilities
- Project is now configured with setup.cfg. There should be no change to package users.
- Added processing of schemachange-config.yml with jinja templating engine.
- Included new Jinja function env_var for accessing environmental variables from the config file.
- Restored CLI tests, hopefully less fragile now.
- Added Github CI workflow to run unit tests and a basic execution test.
schemachange.cli.main
is now defined asdef main(argv: List[str]=sys.argv)
, to allow consumers to pass a list of arguments easily.
- Jinja Template Engine was not recognising scripts in subfolders on windows machines. Jinja was expecting the paths to follow a unix style ie SQL/V2.0.0__ADHOC_SCRIPT.sql but on windows machines this was being passed through as SQL\V2.0.0__ADHOC_SCRIPT.sql.
- Removed fragile unit tests in test_main.py.
- Added support for jinja templates. Any file ending .sql or .sql.jinja will be processed using the Jinja engine
- Added a new optional parameter
--modules-folder
to specify where common jinja template, macro or include files reside
- Added a new optional parameter
- Added new subcommands render and deploy
- The render command can be used to display the final script to the command line.
- The existing functionality moved to a new deploy subcommand
- Fall back behaviour to assume deploy sub command if none provided
- Added reserved variable name
schemachange
and an error will now be raised if supplied by the user via --vars
- Added check for duplicate filenames. An error will now be generated should two scripts in different folders have the same name. The old behaviour resulted in just the last found script being included for execution.
- Loosen dependency version constraints
- Fix crash on dry run with no change history table
- Added support for configuring schemachange through a
schemachange-config.yml
YAML file!- You can now invoke schemachange without supplying any command line arguments if you use the config file
- The filename for the config file is expected to be
schemachange-config.yml
- Command line arguments override values in the config files
- This also makes it easier to pass variables to your scripts
- For more details please see the README for more details.
- Added a new optional parameter
--config-folder
to specify where your config file resides
- Add Always script type (scripts that begin with the letter 'A'). Always scripts are executed with every run of schemachange
- Fix repeatable scripts to only execute if there is a change in the script. Repeatable scripts will not be executed with every run anymore!!!
- IMPORTANT: If you were relying on the existing behavior, please rename those scripts to start with the letter 'A' (see above)
- Updated versioned script filename parsing logic to use lazy regex matching for splitting version tags
- This addresses a bug with having double underscores (__) in the description
- Added support for unencrypted private keys
SNOWFLAKE_PRIVATE_KEY_PASSPHRASE
environment variable is no longer required if the key is not encrypted
- Added 'schemachange' as an application parameter when connecting, to enable usage stats.
- Remove requirement for running user to have CREATE SCHEMA privileges for --create-change-history-table when schema already exists (#42)
- Bumped snowflake-connector-python to 2.4.2 and relaxed the pip dependency to ~= (pick the latest patch release 2.4.X on install)
- Bumped the docker container python version to 3.9 as snowflake-connector-python now supports this as of 2.4
- Created a 'Dockerfile-src' for users wanting to build schemachange themselves from source in Docker
- Renamed snowchange to schemachange
- Please be advised that the new default path for the change history table is now
METADATA.SCHEMACHANGE.CHANGE_HISTORY
(the schema name has been changed fromSNOWCHANGE
toSCHEMACHANGE
). The easiest thing to do is rename the metadata schema in Snowflake. The other option is to leave it as is and use the--change-history-table
(or-c
) parameter to override the default.
- Added a new optional parameter
--dry-run
to preview scripts that will be applied by snowchange.
- Added a Snowflake query tag to all snowchange queries. If the query is issued by the tool the tag will be "snowchange #.#.#" (e.g. "snowchange 2.7.0") and if the query is part of a change script the tag will be "snowchange #.#.#;<script name>" (e.g. "snowchange 2.7.0;V1.1.1__initial_database_objects.sql")
- Added a new optional parameter
-d
or--snowflake-database
to specify the default database to use (which can always be overridden in an individual change script) - Added a new optional parameter
--create-change-history-table
to create the change history table if it does not exist
- The default mode of operation now is to not create the change history table if it doesn't exist. Instead, now if the history table doesn't exist the tool will fail by default.
- Added a check to see if the change history table exists before trying to create it, which is now also dependent upon the
--create-change-history-table
command line argument. - Cleaned up command line argument descriptions
- Removed the ability for snowchange to create the database for the change history table. snowchange now requires the database to be created ahead of time.
- Support for encrypted key pair authentication
- PyPI package support so that snowchange can be installed through pip
- Dockerfile for building Docker images
- Allow for .SQL file extensions (common in Windows environments) in addition to .sql extensions
- Support for "repeatable" scripts such as stored procedures, functions etc
- Support for variables in change scripts (following a Jinja expression syntax)! See the README for more details.
- A new optional parameter
--vars
which accepts a JSON formatted string of variables and values (e.g.{"variable1": "value1", "variable2": "value2"}
)
- Add the Snowflake account name to the script output to provide more log context
- Removed the deprecated
--snowflake-region
parameter. Instead use the-a
or--snowflake-account
account parameter. See Usage Notes for the account Parameter (for the connect Method) for more details on how to structure the account name.
- Support for cross-database dependencies!
- Support for override the location and name of the change history table with the new parameter
--change-history-table
(or-c
) - Change log for snowchange project (this CHANGELOG.md file)
- The required project folder structure, removing the database folder convention
- Where the change history table gets created and how it gets named
- The schema of the change history table (removed INSTALLED_RANK and renamed/reordered a few columns)
- Updated the getting started section of the README.md to make the getting started steps more clear
- The ability for snowchange to create user databases directly (now the user must explicity do so in their change scripts)
- The
--environment-name
and--append-environment-name
parameters