Snowpack Data's internal AI automations for simple, robust, and highly automated Data stack deployments
Project description
Snowpack Stack
snowpack_stack is Snowpack Data's modular, configuration-driven data pipeline automation framework that enables comprehensive, robust, and highly automated Data stack deployments.
Installation
Install Snowpack Stack from PyPI:
pip install snowpack-stack
For specific versions:
pip install snowpack-stack==X.Y.Z # Replace X.Y.Z with the desired version
Version Information
You can check the installed version in two ways:
# Via command line
snowpack --version
# In Python code
from snowpack_stack import __version__, get_version
print(f"Version from constant: {__version__}")
print(f"Version from function: {get_version()}")
Initial Setup
Environment Setup
The system often requires environment variables for database connections and other configuration. Create a .env file in your project directory if needed by your tools or configurations:
# Example .env content (adjust based on your tools)
# PostgreSQL database connection details
CLOUD_SQL_USER=your-user
CLOUD_SQL_PASSWORD=your-password
CLOUD_SQL_DATABASE_NAME=your-database
CLOUD_SQL_PORT=5432 # Standard PostgreSQL port
# BigQuery settings
SERVICE_ACCOUNT_FILE=.gcp-key.json
PROJECT_ID=your-project-id
Authentication / User Identification
You can optionally set your email for identification and usage tracking:
snowpack setup auth --email your.email@example.com
This will store the email locally for use by Snowpack Stack features.
Configuration (Example: Asset Generation)
If using features like automated asset generation, create an autogen_config.yaml file in your project:
etl_owner: "your.email@example.com"
source:
type: "postgres"
connection_name: "postgres_cronos" # Must match your Bruin connection name
database:
user: "${CLOUD_SQL_USER}"
password: "${CLOUD_SQL_PASSWORD}"
database: "${CLOUD_SQL_DATABASE_NAME}"
port: "${CLOUD_SQL_PORT}"
schemas:
public: # Process all tables in the public schema
tables: ["*"]
ingestion: "ingestr"
transformer: "bruin"
destination:
type: "bigquery"
connection:
service_account_file: "${SERVICE_ACCOUNT_FILE}"
project_id: "${PROJECT_ID}"
Command Line Interface
Snowpack Stack provides a CLI for building assets, setting up the environment, and managing tools.
Build Commands (Example: Bruin Assets)
# Build all assets (behavior might depend on registered tools/config)
snowpack build
# Build only Bruin assets
snowpack build bruin
# Build specific Bruin asset types
snowpack build bruin yaml
snowpack build bruin sql
Setup Commands
# Verify installation and configuration
snowpack setup verify
# Configure authentication/user email
snowpack setup auth --email your.email@example.com
# Run initial setup (may perform multiple steps)
snowpack setup
Tool Management
Snowpack Stack includes a tool manager to help you add, verify, and remove data tools like dbt and Bruin.
Adding a Tool
To add a tool to your project:
snowpack add [tool_name]
For example:
snowpack add dbt
This will:
- Verify if the tool is installed.
- Provide installation guidance if needed.
- Check for outdated versions.
- Help you initialize a new project or register an existing one.
- Register the tool in your Snowpack Stack metadata.
Removing a Tool
To remove a tool from tracking:
snowpack remove [tool_name]
This will:
- Remove the tool from Snowpack Stack tracking.
- Provide guidance on manual cleanup.
Supported Tools
Currently supported tools:
- dbt - Data Build Tool (getdbt.com)
- bruin - Bruin transformation engine (getbruin.com)
Python API Usage (Example: Asset Generation)
import snowpack_stack
# Optional: set your email for identification if not done via CLI
# snowpack_stack.set_user_email("your.email@example.com")
# Generate YAML assets based on autogen_config.yaml
yaml_results = snowpack_stack.generate_yaml_assets() # Assuming a generator is implemented
print(f"Generated {len(yaml_results)} YAML assets")
# Generate SQL transformation assets based on autogen_config.yaml
sql_results = snowpack_stack.generate_sql_assets() # Assuming a generator is implemented
print(f"Generated {len(sql_results)} SQL assets")
# Or run all registered generators at once
all_results = snowpack_stack.run_all() # Assuming a run_all mechanism exists
print(f"Generated {len(all_results)} total assets")
Output Files (Example: Asset Generation)
Files generated by features like asset generation are typically placed relative to your project structure. For example, Bruin assets might be generated in:
{project_root}/bruin-pipeline/assets/
- YAML Files (
raw_{table}.asset.yml): Table metadata, ingestion settings, columns. - SQL Files (
{table}.sql): Transformation queries with metadata blocks.
Architecture
Snowpack Stack follows a modular approach:
- Core Layer: Configuration, validation, utilities, tool management.
- Generator Layer: Asset creation logic (optional feature).
- CLI Layer: Command interfaces.
- Authentication/Identification: User identity management.
Key Features (Examples)
- Tool Management: Add, remove, and verify data tools.
- YAML Asset Generation (Optional Feature)
- Bruin-compatible YAML files.
- Automatic schema discovery.
- Proper data typing.
- SQL Asset Generation (Optional Feature)
@bruinmetadata blocks.- Clean data access queries.
- Consistent transformation patterns.
- Environment Management
- Secure credential handling.
- Flexible configuration (
.env,autogen_config.yaml).
Troubleshooting
Common Issues
-
Authentication/Identification Failures:
- Verify email format if using
setup auth. - Check if the environment variable
SNOWPACK_USER_EMAILis set correctly if required by a specific feature.
- Verify email format if using
-
Environment Variables Not Found:
- Ensure your
.envfile is in the project root or parent directory as expected by your tools/config. - Check for typos in variable names.
- Ensure your
-
Database Connection Issues (If applicable):
- Verify database credentials in your
.envfile or tool configuration. - Check network connectivity to the database server.
- Ensure the database server is running.
- Verify database credentials in your
-
Output Files Not Generated (If applicable):
- Check the log output for errors (
snowpack ...). - Verify the target output directory exists (e.g.,
bruin-pipeline/assets). - Ensure the user running the command has write permissions.
- Check the log output for errors (
-
Tool Not Found / Version Issues:
- Ensure the required tool (e.g.,
dbt,bruin) is installed and available in your PATH. - Run
snowpack add <tool_name>to verify the tool and potentially get installation help.
- Ensure the required tool (e.g.,
Development
For development and contributing to Snowpack Stack, please refer to the GitHub repository and the internal developer documentation (README.md).
Installing Pre-Release Versions
For testing development or pre-release versions from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ snowpack-stack==X.Y.Z-identifier
(Replace X.Y.Z-identifier with the specific pre-release version string).
License
Snowpack Stack is released under the BSD 3-Clause License.
Support
If you encounter any issues or need assistance, please reach out to the Snowpack team. For Snowpack developers who need access to internal features, please contact the team directly.
Table of Contents
Usage
Python API
import snowpack_stack
# Optional: set your email for identification
snowpack_stack.set_user_email("your.email@example.com")
# Generate YAML assets for database tables
yaml_results = snowpack_stack.generate_yaml_assets()
# Generate SQL transformation assets
sql_results = snowpack_stack.generate_sql_assets()
# Or run all generators at once
all_results = snowpack_stack.run_all()
Output Files
Files are generated in:
{parent_directory}/bruin-pipeline/assets/
Where {parent_directory} is typically the parent of your project directory.
- YAML Files (
raw_{table}.asset.yml): Table metadata, ingestion settings, columns - SQL Files (
{table}.sql): Transformation queries with metadata blocks
Architecture
Snowpack Stack follows a modular approach:
- Core Layer: Configuration, validation, utilities
- Generator Layer: Asset creation logic
- CLI Layer: Command interfaces
- Authentication: User identity management
Key Features
-
YAML Asset Generation
- Bruin-compatible YAML files
- Automatic schema discovery
- Proper data typing
-
SQL Asset Generation
@bruinmetadata blocks- Clean data access queries
- Consistent transformation patterns
-
Environment Management
- Secure credential handling
- Flexible configuration
- Symbolic link support
Troubleshooting
Common Issues
-
Authentication Failures
- Verify email format
- Check
SNOWPACK_USER_EMAILenvironment variable
-
Environment Variables Not Found
- Ensure
.envfile is in the project root or parent directory - Check for typos in variable names
- Ensure
-
Database Connection Issues (If applicable)
- Verify database credentials in
.envfile or tool configuration - Check network connectivity to the database server
- Ensure the database server is running
- Verify database credentials in
-
Output Files Not Generated (If applicable)
- Check the log output for errors (
snowpack ...) - Verify the target output directory exists (e.g.,
bruin-pipeline/assets) - Ensure the user running the command has write permissions
- Check the log output for errors (
-
Tool Not Found / Version Issues
- Ensure the required tool (e.g.,
dbt,bruin) is installed and available in your PATH - Run
snowpack add <tool_name>to verify the tool and potentially get installation help
- Ensure the required tool (e.g.,
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snowpack_stack-0.7.7.tar.gz.
File metadata
- Download URL: snowpack_stack-0.7.7.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9409f09bfbb6130e16df0232a338ddb1128557851a2780bd2706cc4287df5ad
|
|
| MD5 |
20ac46471c3cdcd714f9870eebdea5af
|
|
| BLAKE2b-256 |
0b722e559abb93126a17a36b38c174489f11f9f57922bf9b03da1673edac8f4c
|
Provenance
The following attestation bundles were made for snowpack_stack-0.7.7.tar.gz:
Publisher:
pypi-publish.yml on snowpackdata/snowpack_stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snowpack_stack-0.7.7.tar.gz -
Subject digest:
b9409f09bfbb6130e16df0232a338ddb1128557851a2780bd2706cc4287df5ad - Sigstore transparency entry: 200246981
- Sigstore integration time:
-
Permalink:
snowpackdata/snowpack_stack@ec8a246b0182070ef3ee1eaad743f6d8bf00938f -
Branch / Tag:
refs/tags/v0.7.7 - Owner: https://github.com/snowpackdata
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@ec8a246b0182070ef3ee1eaad743f6d8bf00938f -
Trigger Event:
push
-
Statement type:
File details
Details for the file snowpack_stack-0.7.7-py3-none-any.whl.
File metadata
- Download URL: snowpack_stack-0.7.7-py3-none-any.whl
- Upload date:
- Size: 75.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37f607e7a90e2dc776e09854a3f6eba027dae8d7a71a028a32ae1e74ff39835
|
|
| MD5 |
22dfc929a2876660c9678b6e9f7cb2c2
|
|
| BLAKE2b-256 |
127a649b4793fbc527e850be1699fb16cfeca3d15ec4a978463fbd8785d50f54
|
Provenance
The following attestation bundles were made for snowpack_stack-0.7.7-py3-none-any.whl:
Publisher:
pypi-publish.yml on snowpackdata/snowpack_stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snowpack_stack-0.7.7-py3-none-any.whl -
Subject digest:
a37f607e7a90e2dc776e09854a3f6eba027dae8d7a71a028a32ae1e74ff39835 - Sigstore transparency entry: 200246987
- Sigstore integration time:
-
Permalink:
snowpackdata/snowpack_stack@ec8a246b0182070ef3ee1eaad743f6d8bf00938f -
Branch / Tag:
refs/tags/v0.7.7 - Owner: https://github.com/snowpackdata
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@ec8a246b0182070ef3ee1eaad743f6d8bf00938f -
Trigger Event:
push
-
Statement type: