Skip to main content

Better stored procedure management

Project description

Contributors Forks Stargazers Issues LinkedIn


⚙️ 🚀

Sprocketship

Better stored procedure management

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License

About The Project

sprocketship makes it easy to develop, manage, and deploy stored procedures in Snowflake. Using the language of your choosing, you can write the contents of your stored procedure separately from its configurations (e.g., EXECUTE AS, RETURN TYPE, etc.).

Built With

(back to top)

Getting Started

Installation

pip install sprocketship

Usage

Currently, sprocketship expects a .sprocketship.yml file and a procedures/ directory at the same level in a directory structure.

├── dbt_models
│   ├── customers.sql
│   ├── products.sql
├── procedures
│   ├── admin
│   │   ├── create_database_writer_role.js
│   │   ├── create_database_reader_role.js
│   ├── development
│   │   ├── create_temp_database.js
└── .sprocketship.yml

The yaml path to each procedure in the sprocketship.yml should follow that of the paths to their corresponding files in the procedures/ directory.

procedures:
  development:
    - name: create_temp_database
      database: !env_var SNOWFLAKE_DATABASE
      schema: !env_var SNOWFLAKE_SCHEMA
      ...

  admin:
    - name: create_database_reader
      database: !env_var SNOWFLAKE_DATABASE
      schema: !env_var SNOWFLAKE_SCHEMA
      ...

    - name: create_database_writer
      database: !env_var SNOWFLAKE_DATABASE
      schema: !env_var SNOWFLAKE_SCHEMA
      ...

From here, simply run

$ sprocketship liftoff

from the project directory (or provide the directory, e.g. sprocketship liftoff my/directory/path) and sprocketship will launch your stored procedures into the given directory.

Exhaustive Options for Stored Procedure Configuration

name: The name of the procedure
database: The name of the database where the procedure will be stored
schema: The name of the schema where the procedure will be stored
language: The language of the procedure definition
execute_as: caller or owner
args:
    - name: Name of argument
      type: Type of argument
      default: (Optional) default value for the argument
returns: The return type
comment: Explanation of the procedure

Support

sprocketship currently only supports Javascript-based stored procedures (Python support coming soon!). Additionally, there are a few options from the CREATE STORED PROCEDURE function that are not yet supported:

  • RETURNS <result-data-type> NOT NULL
  • CALLED ON NULL INPUT | { RETURNS NULL ON NULL INPUT | STRICT }
  • VOLATILE | IMMUTABLE (deprecated)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

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

sprocketship-1.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

sprocketship-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file sprocketship-1.0.0.tar.gz.

File metadata

  • Download URL: sprocketship-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for sprocketship-1.0.0.tar.gz
Algorithm Hash digest
SHA256 20daf599222eec37b5cc96a6116f8aee74465b409a60937eb05a76a72e35f533
MD5 a983c05822cf3333ad7e5c9ff40319ea
BLAKE2b-256 482710566917a2c80a3fc3073885668591ea8c11c0f322ed1e5414013ed56417

See more details on using hashes here.

File details

Details for the file sprocketship-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sprocketship-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for sprocketship-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecceadb137f79ddcba6440e12302a83e3e9de08d3b9ea9996145d01221a7d7ec
MD5 8019b8d33cf4f58df4874393d22fc002
BLAKE2b-256 dbb47253ce7540a4c61b89bf287ab98adba18eef95dc770e280173409a091eef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page