Ice Pick
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]
Metadata
Release files for snowflake-ice-pick 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| snowflake_ice_pick-0.0.6.tar.gz | 22.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| snowflake_ice_pick-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.6 kB
Release files / snowflake_ice_pick-0.0.6.tar.gz
| Download URL | snowflake_ice_pick-0.0.6.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ecc3d0eb2e19dc1f6e6be8596c6f1bb986f0b2dac7c8067077c204d860ac9c6
|
|
BLAKE2b-256 checksum How to use checksums |
50b1516ebac7df7c058c38aec390c5c16dee768ba47d9a566edec127eaef0b09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.3
|
Release files / snowflake_ice_pick-0.0.6-py3-none-any.whl
| Download URL | snowflake_ice_pick-0.0.6-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cdc54d4a5bb97205e68742762cbc8c9c8e62d5a81a00aea3c5bd5c5b1b5df17
|
|
BLAKE2b-256 checksum How to use checksums |
3b189c8eb13c11aa0fd0369ae9f3ec1904c8425e961754040a17c5d20a4ec443
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.3
|
Security for snowflake-ice-pick 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.