Warning
This repository has been archived in favor of tundri
No new features or bug fixes will be released here
Python package to manage Snowflake objects and permissions
- Drop and create Snowflake objects that are needed
- Set up permissions for the objects using Permifrost
The run subcommand is going to drop/create objects and run Permifrost.
snowflake_manager run --permifrost_spec_path examples/permifrost.yml --drysnowflake_manager run --permifrost_spec_path examples/permifrost.ymlCreate virtual environment, activate and upgrade pip
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pipInstall from the GitHub repository
pip install git+https://github.com/Gemma-Analytics/snowflake-manager.gitNote: you can specify a tag to install a specific version:
pip install git+https://github.com/Gemma-Analytics/snowflake-manager.git@v1.0.0
Add a valid Permifrost spec file to your repository. You can use the example provided in the examples folder.
You need to have a user with securityadmin and sysadmin roles.
Set up your Snowflake connection details in the environment variables listed below.
PERMISSION_BOT_ACCOUNT=abc134.west-europe.azure # Your account identifier
PERMISSION_BOT_USER=PERMIFROST
PERMISSION_BOT_PASSWORD=...
PERMISSION_BOT_ROLE=SECURITYADMIN # Permifrost requires it to be `SECURITYADMIN`
PERMISSION_BOT_DATABASE=PERMIFROST
PERMISSION_BOT_WAREHOUSE=ADMINNote: It is encouraged to use a .env file to store secrets and environment variables locally
- The .env file has to live in the same folder as the Permifrost spec file
- Snowflake-manager only parses files that are called ".env"; if the file that stores your secrets has a different name, Snowflake-manager will ignore it
Snowflake-manager automatically checks the folder, where the Permifrost spec file lives, for a .env file, and parses it. If no .env file exists locally, Snowflake-manager will fall back to the system's environment variables. If an environment variables exists in both, the .env file and the system's environment variables, environment variables in the .env file will take precedence (i.e., Snowflake-manager will override the system's environment variable with the same name)
Attention: we currently use a manual process to test new releases that is only applicable to Gemma's internal infrastructure
Before merging changes to main, please test the changes using the develop branch. Steps:
- Create a new branch for the new feature e.g.
my-new-feature - When finished, create a PR with
developbranch as the base branch - Merge the PR into
developbranch - In Gemma's best practices repo, merge a dummy change on
permifrost.ymlto trigger the CI/CD pipelines (they are configured to installsnowflake-managerfrom thedevelopbranch) - If both the PR (dry run) and merge to main (normal run) pipelines work, proceed to create a new PR in this repo from branch
developtomain - Once the PR from
developtomainis merged, the changes will be available to all clients
Install the development dependencies
pip install -r requirements-dev.txtInstall the package locally in editable mode
pip install --editable .Then you will be able to edit the code and run the CLI to test changes immediately.
You should run the unit tests after changing the code:
pytestLikewise, whenever a new functionality is implemented, a new test for it should be added.
Please run the command below to format the code
black .