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 Schemas
snowman model generate
Check Differences Between Python Model and Snowflake Information Schemas
snowman model diff --check
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.16.tar.gz
(36.6 kB
view hashes)
Built Distributions
Close
Hashes for snowman_py-0.0.16-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f96f6fd3beda47b5412ed5db63f654014808c4a44f68dbd8c5f20389ab33e649 |
|
MD5 | 2974fcd1500370df10dae0b5ff32acbe |
|
BLAKE2b-256 | 40a33b07ae17d14b338834e6499f0fcd2acd21cc4bfcd5e7c26c1ec4965790ff |
Close
Hashes for snowman_py-0.0.16-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cf4a9bde22794a1e1aadbdf1d88072e47f901d133be61be0c49fe1b32219c33 |
|
MD5 | fc8f8109537232ec5cb2de9ec1d5a442 |
|
BLAKE2b-256 | 75db36e419ca8476716d1bd56cef226f66985cf8b4157738834292966e49df4c |
Close
Hashes for snowman_py-0.0.16-py3-none-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90bd1ddc29197f50137fbf593cd51347b72bc7846bd4b311766395a65d67cdc5 |
|
MD5 | b05042b1a511e585405228c32626012d |
|
BLAKE2b-256 | 972a6f8b671c02d2c5fd136cd1a77381c1ce9c8f325475ba604664f82d2b655b |
Close
Hashes for snowman_py-0.0.16-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc5383b2a466af2e21d589d0c9ddebf66da6fb022b6ca09eb99c9b30dc75d533 |
|
MD5 | a477c4708263b47812aa2220d5c82a5a |
|
BLAKE2b-256 | 4cc64248b000c15ee2bd111c6164c1a983999eada38b5c28fdc4d9eeff341c79 |
Close
Hashes for snowman_py-0.0.16-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0a1b401627cc009531aeea5f2de9bed403b6bee3160623babb989f4dd8e738f |
|
MD5 | 548a66d6814470dd2631605b7782aedc |
|
BLAKE2b-256 | fd5355ff3c232f4d19ed9bc9b922487a591fc4f18cbcd759ebd66a4e38ff4aef |
Close
Hashes for snowman_py-0.0.16-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f80b361770a2f6094870c2d313b28b54601acfab63eba91ada9aca39418d68b |
|
MD5 | 4557323113d94a8f675f00e2235fa91a |
|
BLAKE2b-256 | c5749e0f23ac915002d398e997989395c493a774fb1cef434374d80dd31320e0 |
Close
Hashes for snowman_py-0.0.16-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bf34adc9245bfb8b869309c9c9cb5816f54cdd4396a418d3c1728da96ffab94 |
|
MD5 | 1a8dfc7e4ec3d7385229cfc9f45746e1 |
|
BLAKE2b-256 | a88cda14ac50792901733aaf0848160ddd7f7313e19de110a22c0324f973d5a6 |
Close
Hashes for snowman_py-0.0.16-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f45ada1fee642d677dfdf04d6750f1bdc5ef4b81b3e18fc6cdbbe9dac70acb3 |
|
MD5 | 7cc5f4fb952070dbd1119ccaf65170e2 |
|
BLAKE2b-256 | 9d3fbc4c2eaba4fb9507e0756f1dfcb19c7fae42eee2ae6b4d207f06a082f0cd |
Close
Hashes for snowman_py-0.0.16-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ff571c897db9fe2ff1e3b4e1aba02697de87aade883d94c181c52ed1163195b |
|
MD5 | 01e80f68d51c5f569ed0cd46539f7ac8 |
|
BLAKE2b-256 | d6a32abe51420beb9fc86e360239847478e900d06bae8abec9439dcc6f73ec48 |