Skip to content

GrahamTheCoder/gitsnow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitsnow

Easily sync objects from git to snowflake (deployment), and from snowflake to git (drift detection and reintegration).

Usage

All commands require a --scripts-dir option that specifies the directory containing your SQL scripts. The sqlfluff configuration will be automatically read from the parent directory of the scripts directory (looking for .sqlfluff file).

Basic structure

project/
├── .sqlfluff              # Configuration file (automatically detected)
└── schemas/               # Scripts directory (passed to --scripts-dir)
    └── my_schema/
        ├── tables/
        │   └── customers.sql
        └── views/
            └── customer_summary.sql

Commands

All commands follow this pattern:

gitsnow --scripts-dir <path-to-scripts> <command> [command-options]

Debug

To write out db to folder as formatted create scripts: uv run python -m debugpy --listen localhost:5678 -m cli.cli --scripts-dir schemas db-to-folder --db-name MyDatabase

To create a script to deploy changes in dependency order: uv run python -m debugpy --listen localhost:5678 -m cli.cli --scripts-dir schemas folder-to-script --db-name MyDatabase --output-file last_deployment.sql

Intended usage

The primary commands to sync changes will be...

Local

To write out db to folder as formatted create scripts: gitsnow --scripts-dir schemas db-to-folder --db-name MyDatabase

To create a script to deploy changes in dependency order: gitsnow --scripts-dir schemas folder-to-script --db-name MyDatabase --output-file last_deployment.sql

Snowflake - todo

To push a commit with any db drift: gitsnow_push_drift('@your_git_stage/branches/main/schemas') To generate a script to apply the changes from main: gitsnow_script_pull('@your_git_stage/branches/main/schemas')

About

Link git to snowflake

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages