Python model and query builder for Snowflake.
Project description
Snowman
Python model and query builder for Snowflake.
Install
pip install snowman-py
CLI Tool
Initialize Snowman Configuration
snowman init
Generate Python Model From Snowflake Information Schema
snowman model generate
Query Builder
Insert Query
import textwrap
from snowman.query import insert
from your.database.schema import User
query, params = (
insert.into(
User,
).values(
{
"id": 1,
"name": "John Doe",
}
)
).build()
expected = textwrap.dedent(
"""
INSERT INTO
database.schema.users
(
id,
name
)
VALUES (
%s,
%s
)
"""
).strip()
assert query == expected
assert params == (1, "John Doe")
Update Query
import textwrap
from snowman.query import update
from your.database.schema import User
query, params = (
update(
User,
)
.set(
{"name": "Jane Doe"},
)
.where("id = %s", [1])
).build()
expected = textwrap.dedent(
"""
UPDATE
database.schema.users
SET
name = %s
WHERE
id = %s
"""
).strip()
assert query == expected
assert params == ("Jane Doe", 1)
Delete Query
import textwrap
from snowman.query import delete
from your.database.schema import User
query, params = (
delete.from_(
User,
).where(
"id = %s",
[1],
)
).build()
expected = textwrap.dedent(
"""
DELETE FROM
database.schema.users
WHERE
id = %s
"""
).strip()
assert query == expected
assert params == (1,)
Truncate Query
from snowman.query import truncate
from your.database.schema import User
query, params = truncate.table(User).build()
expected = "TRUNCATE TABLE database.schema.users"
assert query == expected
assert params == ()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
snowman_py-0.0.13.tar.gz
(33.1 kB
view hashes)
Built Distributions
Close
Hashes for snowman_py-0.0.13-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d27740d43856db0009b49020de5da169c5af9d6d8a18401d32386a5bda944cfb |
|
MD5 | 36c4e886e4d30bafc601786456ffec45 |
|
BLAKE2b-256 | 9e8b57f772f64a5d0bf1280ea9163dc51f2a733106c6106987e99a8446f76f3f |
Close
Hashes for snowman_py-0.0.13-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b61f2b02d6f1ee42cb90e6f574b839cafe3750f9c773c61718f48d4bf6a65cc |
|
MD5 | 343f51b857db16f53e7c38dde5900a0a |
|
BLAKE2b-256 | 0b187bddf2fb79e0ee158cabdedae1de078ab299d9db68954c73d5220496b927 |
Close
Hashes for snowman_py-0.0.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f64555d2b2d84f7e29337275d2c4d31d32647c7c99c4a612ccf9c8c750a314c1 |
|
MD5 | a17c1214a19ae6c4a04bd57c1f8c22ae |
|
BLAKE2b-256 | fd0a6841156814248ce7701472613476df6b5e4afce85504d4217eaa4b8c74fe |
Close
Hashes for snowman_py-0.0.13-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f0884e686ac15c79994b8a56d4c3d1fc7bc1166d6af3f2ed1e1c19d07e2090 |
|
MD5 | 625c28ee2c2897087caa1ae812bfe2eb |
|
BLAKE2b-256 | e2579fc046c0f373fd4c2b16fd7edb58fb13e5e83c42e7bd929578f1b1957c45 |
Close
Hashes for snowman_py-0.0.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c1b4355400ef8891767f1a40f32dd1a413fb0059a419742f3737125996ab7d6 |
|
MD5 | 71c185750c3ddefff78b9967f7559d35 |
|
BLAKE2b-256 | ed7201bd71ea3503cf9fed2146e206d6063641512b70b016b59404684bf6b3d0 |
Close
Hashes for snowman_py-0.0.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ba1cfa4faec9f00597951743d8f09ef85e76439fabd7253982dca46fec974e |
|
MD5 | a5db017d2f78f0c4592c3a904e1976f7 |
|
BLAKE2b-256 | 722eadb55c92702df51e9901bbdaf3116aeef49d8cad9345132fab486bc7360f |
Close
Hashes for snowman_py-0.0.13-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82e3d3ad15d121bf20d0829a1d473c1ec6f6ab335b9f0394305186c5379ebb84 |
|
MD5 | 122c55243f00afa8602d7d365497536e |
|
BLAKE2b-256 | ebda349f67fa22313dc33ac55f7ba12085be8aa289def8bac390c53b7e458a1a |
Close
Hashes for snowman_py-0.0.13-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7613d8fe4e766beee84749f2eb3bcb56ef9ec7bd8d534c36d306fdbf24ddf4f6 |
|
MD5 | 62394e041e3be894edcfe966a3f0ec40 |
|
BLAKE2b-256 | 58136b90488a5c28db0df8b67f6a00fb03d51bce5c0e2193c6d1485a4e7e2e4c |