Python model and query builder for Snowflake.
Project description
Snowman
Python model and query builder for Snowflake.
Install
pip install snowman-py
CLI Tool
Create Snowman Config
snowman config create
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
VALUES (
%(id)s,
%(name)s
)
"""
).strip()
assert query == expected
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 = 1",
)
).build()
expected = textwrap.dedent(
"""
UPDATE
database.schema.users
SET
name = %(name)s
WHERE
id = 1
"""
).strip()
assert query == expected
Delete Query
import textwrap
from snowman.query import delete
from your.database.schema import User
query, params = (
delete.from_(
User,
).where(
"id = 1",
)
).build()
expected = textwrap.dedent(
"""
DELETE FROM
database.schema.users
WHERE
id = 1
"""
).strip()
assert query == expected
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
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.3.tar.gz
(30.6 kB
view hashes)
Built Distributions
Close
Hashes for snowman_py-0.0.3-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 871fcdf2dc823259188ef11abc8a4de572b755a59fa0ff719fbe368f9893f68b |
|
MD5 | 0c531dd3f714299d73fb560ed6a8a804 |
|
BLAKE2b-256 | 9fb4f3fa2cf523dd81a689e6a29727f6624565e6feb93eca4f9f6753f633099a |
Close
Hashes for snowman_py-0.0.3-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09b06307e83edfe5af84ca0361203e0f1c877ac1f759ef6c499339e215299d6a |
|
MD5 | 9aaded7863ceb4f36409cb62b96c19e1 |
|
BLAKE2b-256 | e8372595b8731164c99166b9d0eb8c3b6d671bedf282d2829ae86e874ae0ab81 |
Close
Hashes for snowman_py-0.0.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4adb26df6fb0583ed9cf24b40e806388c960179c9e656a8ed4cb1264efd8f72 |
|
MD5 | e69e298d568d845b5000f3115798a42a |
|
BLAKE2b-256 | 031898c97e2881ce075745af033187747f642323eb3d61f631e4ef70580c2848 |
Close
Hashes for snowman_py-0.0.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfef88c53d0b5b22efd31a9fac24d1bc32e72c0646dc86168462289ac0a3ba24 |
|
MD5 | b2e1cadbe894a8faf5120ab8d041a838 |
|
BLAKE2b-256 | 5d6984b0000f388a44a443267b261753da221c17b42d17f927e4ca7217dcdd97 |
Close
Hashes for snowman_py-0.0.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e497a64ecf5f67868993ec32943197509f99de82a9eab2df587c8566ff825228 |
|
MD5 | 1f7ff8efe16709e0da492fb290493109 |
|
BLAKE2b-256 | 9b33cbdfe3f5e2e02bc354dbd35cfe78b4ef8317220e4da43059c0ca662cde17 |
Close
Hashes for snowman_py-0.0.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7154aefe8aae5098622b982870acf76ceec6681c6592ad9f40256844ec83237 |
|
MD5 | 6045f6719ab62e8fb0e87be3416b64c3 |
|
BLAKE2b-256 | 0906e2e3f9be721db4fc728651aa9161d52c1842f6b6a8ad57a7ddd342d31d08 |
Close
Hashes for snowman_py-0.0.3-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e4ef6986696e3bbb63f141b4dee9bc9a0cf45155f9e6d0475af2a85224e3a8f |
|
MD5 | c3cfbf88f15c806e893aaced0458402a |
|
BLAKE2b-256 | 3c1b337ca0dbef23e83e3857a8755998561e7c312a601ef255d6ac733443ddaf |
Close
Hashes for snowman_py-0.0.3-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e43948795d02a66d52f5510127678b4ac933f97ee1e321f1d5434b946b829284 |
|
MD5 | bbebeada81cf21ebdef78a56e4f9b3df |
|
BLAKE2b-256 | ab98ef909f12521470f9abdc7c0d3c769cbf3b0c5af6dd97b68a272e8cf6fd60 |