Python package to manipulate Snowsight worksheets and easily apply Git versioning on it.
Project description
Snowflake Git
Worksheet Versioning
Inspired by a snowflake developers maintained repository.
Git integration
The extension is designed to apply git versioning on worksheets while developing on Snowsight, fully taking advantage of its functionalities.
The following workflow is advised :
- [Start session] Upload worksheet from local branch to a user Snowsight workspace
- Test, update and validate on Snowsight
- [End session] Update local branch with modified Snowsight worksheets
Installation
Entry points are accessible through a CLI once the package is installed. To install it, please follow the following steps :
# [Optional: Python virtual environement]
$ pyenv virtualenv 3.10.4 sf
$ pyenv activate sf
# [Mandatory: Pip install]
$ pip install -U pip
$ pip install sf_git
# [Check your installation]
$ sfgit --help
# [Should result in:]
# Usage: sfgit [OPTIONS] COMMAND [ARGS]...
#
# Options:
# --help Show this message and exit.
#
# Commands:
# commit Commit Snowsight worksheets to Git repository.
# config Configure sfgit for easier version control.
# fetch Fetch worksheets from user Snowsight account and store them in...
# init Initialize a git repository and set it as the sfgit versioning...
# push Upload locally stored worksheets to Snowsight user workspace.
Commands have been created to import/export (respectively fetch/push) snowsight worksheets to/from local.
Git configuration
Warning A git repository is necessary to manage worksheets. You can either use an existing one or create a new one.
To apply versioning to your worksheets, you need to configure Git information through the config command.
First, set git repository to be used:
# if you want to use an existing git repository
$ sfgit config --git-repo <path_to_git_repo>
# if you want to create a new one
$ sfgit init <path_to_git_repo>
Then, set a location to save your worksheets within this git repository:
$ sfgit config --save-directory <path_to_worksheets_persistency_directory>
Authentication
Currently, two authentication modes are supported i.e. credentials (PWD) and single sign-on (SSO).
Commands requiring Snowsight authentication all have options to provide at command time. If you don't want to manually input them everytime, you can set them at Python/Virtual environement level with :
$ sfgit config --account <your_snowsight_account_id>
$ sfgit config --username <your_snowsight_login_name>
$ sfgit config --password <your_snowsight_password> # unnecessary for SSO authentication mode
Usage
Import user worksheet locally :
$ sfgit fetch -username tdambrin -account-id my_account.west-europe.azure --auth-mode SSO
Commit you worksheets (or through git commands for more flexibility) :
$ sfgit commit --branch master -m "Initial worksheet commit" -username tdambrin
Export user worksheets to Snowsight :
$ sfgit push --auth-mode SSO --branch master
Policies
Feedbacks and contributions are greatly appreciated. This package was made to ease every day life for Snowflake developers and promote version control as much as possible.
For questions, please feel free to reach out by email.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sf_git-1.2.tar.gz
.
File metadata
- Download URL: sf_git-1.2.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff25db66b5a858e4b5ff7c5f2641d3df1d55758e87a996578562919f3e078f9f |
|
MD5 | 5b517b3c906d39590b6c47d043613033 |
|
BLAKE2b-256 | ebc9057f03c92bb14582d16035dd6c386f12b00b30e30d291609bc1750f43436 |
File details
Details for the file sf_git-1.2-py3-none-any.whl
.
File metadata
- Download URL: sf_git-1.2-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48aa09f49609f976661955c48f5d29794159a04a78f94c2f77e919798ae0344b |
|
MD5 | 2c0d58d137d210d2cee8bebacdd2d178 |
|
BLAKE2b-256 | d2562f8bb0cbeb521942c1be7477db13147b19e429ef2f70783470a2c315c0e0 |