Skip to main content

Snowpark extension to cover additional objects and higher level functions

Project description

ice pick logo

Ice Pick

PyPI Latest Release License: MIT Codestyle Black

Ice Pick is a Python package that provides utilities for common operations done on a Snowflake warehouse. Operations range from getting Snowflake object ddl, getting table statistics, and returning account level information.

Many utilities can be automatically packaged and deployed as stored procedures, so they can be executed natively in Snowflake.

Main Features

Interact with schema objects with a Snowpark like interface.
In this initial development two data classes are available: SchemaObject and SchemaObjectFilter. The SchemaObject allows you to interact and retrieve information on the schema object, such as ddl, description, and grants.

The SchemaObjectFilter allows you to quickly return and inspect many schema objects. With the SchemaObjectFilter you can filter on specific databases, schemas, objects or object types using regex. Alternatively you can specify ignore filters to return all objects not in the filter.

Getting Started

Read the docs: https://ice-pick.readthedocs.io/en/latest/



install the library

python -m pip install snowflake-ice-pick

create a snowpark session

Ice pick extends the session to add the additional functionality

from snowflake.snowpark import Session
from ice_pick import extend_session

connection_parameters = {
  "account": "<your snowflake account>",
  "user": "<your snowflake user>",
  "password": "<your snowflake password>",
  "role": "<snowflake user role>",
  "warehouse": "<snowflake warehouse>",
  "database": "<snowflake database>",
  "schema": "<snowflake schema>"
}

session = extend_session(Session).builder.configs(connection_parameters).create()

Example Usage

Return the ddl, description, and grants for a schema object

from ice_pick import SchemaObject

table_obj = session.create_schema_object('TEST', 'SCHEMA_1', 'CUSTOMER', 'TABLE')

# Get the ddl for the specified object
ddl = table_obj.get_ddl()

# Get the description of the object
description = table_obj.get_description()

# Get the grants on the object
grants_on = table_obj.get_grants_on()

# Grant the object to a role with permissions specified in a list
grant = table_obj.grant(["SELECT"], "PUBLIC")

Return bulk ddl for tables and procedures in the TEST database and the databases matching the TEST_* pattern

from ice_pick import SchemaObject, SchemaObjectFilter

# create the fitler, where "*" are wildcards (regex supported)
obj_filter = session.create_schema_object_filter(
                ["TEST", "TEST_*"],        # databases
                [".*"],                    # schemas
                [".*"],                    # object names
                ["tables", "Procedures"]   # object types
            )

# return the schema objects based on the filter
schema_object_list = sp_filter.return_schema_objects()

# Get the ddl for the returned schema objects
ddl_list = [schema_obj.get_ddl() for schema_obj in schema_object_list]

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

snowflake_ice_pick-0.0.5.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snowflake_ice_pick-0.0.5-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file snowflake_ice_pick-0.0.5.tar.gz.

File metadata

  • Download URL: snowflake_ice_pick-0.0.5.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.3

File hashes

Hashes for snowflake_ice_pick-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ba1ee7fbcae78955c88d0cf857a976ca9bff19052ef01fe4fb18fc37d91715d7
MD5 ef36cd1d9525c3608618d4ef151cb834
BLAKE2b-256 bb29d865708dff1476384cd089ebba27568e62137c9a34810328bfa53fb62ba1

See more details on using hashes here.

File details

Details for the file snowflake_ice_pick-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for snowflake_ice_pick-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6d9a1f8e571fb4accfd19193d6bde63bfa2aef859b3ba0fc97a9b7142c55bbf5
MD5 e50ce0c51f18b8991402abc48659e90e
BLAKE2b-256 ff97a2520924f95aa92ec515f2006fa5ce67e6c2b0a5a2f01657583e50fe5798

See more details on using hashes here.

Supported by

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