Snowflake-Labs / schemachange

A Database Change Management tool for Snowflake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I run SchemaChange with no deployment but with updating the change_history table ?

zroytman opened this issue · comments

** What are you trying to accomplish? **
I'm using the SchemaChange as part of our Azure DevOps pipeline. As we already have many DB objects deployed, I'm looking for the way to load the CHANGE_HISTORY table for the first time without deploying (compiling) the objects in the DB.

** What options have you tried so far ? **
I've tried to run the SchemaChange in Dry Mode and expected to get exactly what I need, means updating the CHANGE_HISTORY table without compiling the DB objects themselves. In real, Dry Mode doesn't compile the objects (which is great) but doesn't update the CHANGE_HISTORY table too (which is bad for me).

So is there any way to run the SchemaChange in the mode in need? Any additional flag I missed?

Thanks.

I have a similar problem. We have a list of SQL scripts that have already been executed in our development environment and we want to start using schema change, but we want to record the current scripts in the CHANGE_HISTORY table without executing them.

Hi,
We ran into similar use case and followed these steps, using some python scripts.

  1. Generate DDL's for all the scripts using get_ddl
  2. Save the scripts into folders with pre-defined naming convention. We named files in such a way that they are executed in the order we need.
  3. Had another python script to scan all the files and generate the checksum (we used the function used in schemachange to make sure the same checksum is generated)
    hashlib.sha224(content.encode('utf-8')).hexdigest()

Insert the entries generated from the above step into the schema_change_history table

now apply schema change with dry-run: false and you should not see script changes getting applied
Thanks