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.14.tar.gz
(36.1 kB
view hashes)
Built Distributions
Close
Hashes for snowman_py-0.0.14-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a38a717c1f4938f1d8c76912e9aabea586783efe60935123c9529f77ff1351f |
|
MD5 | cff3f2b949b659c7c6b00a642e90dae7 |
|
BLAKE2b-256 | 106cb2d58ab91fb80b3441614b89a930f42db448618b8f8998526d3803cedfba |
Close
Hashes for snowman_py-0.0.14-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82d7661010b4f227dbedb53c2d8af0d0ba5e7b132c49d9a2bb6e186294fc4ecb |
|
MD5 | 80046908a2d6f644646e6aac2d427b3e |
|
BLAKE2b-256 | d4bf3ff8ace4fd2725ef3589cc0e9bc4a20abbe597ff49e17113b5e8f29c3b26 |
Close
Hashes for snowman_py-0.0.14-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 307de3c54936b7b070d9c6ffa2057e64d3d18e25a3188db87032b3e3abaa780a |
|
MD5 | f734628484924178fa5dcbb6725afa61 |
|
BLAKE2b-256 | 8219a7eb125b6e8ade86d371a0377c3f9e4eced4624bbdd0ab0d8d5895a708a1 |
Close
Hashes for snowman_py-0.0.14-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46e8928a8e7dfd2ee6a5a0abaf65db74ae194d5f7ca7769dc330fdbda037529c |
|
MD5 | d3254554e5f0cf07d6b393ed9d004f17 |
|
BLAKE2b-256 | c97d7e4467921e3f562ad8b533ac0ea4f26515f0e4ffa193234f9529f019e5d0 |
Close
Hashes for snowman_py-0.0.14-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84a890d324479dbf668093365827b74c5518b501894ba203f8e8627db9d837c0 |
|
MD5 | 68e06375973d64a407bc7b44140a4898 |
|
BLAKE2b-256 | 1b81217133bcb9093f903495c768b59be9d48d483061491b81ce3c6f77029355 |
Close
Hashes for snowman_py-0.0.14-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 698cc00513f957eb5f44ab7ba7cbfbbafed56a83cf74638a3d145c792a39758d |
|
MD5 | 2f827b2e4a000d80a40312e20d363cd8 |
|
BLAKE2b-256 | ec73cb4447a1c35f5da17862982974d0164ead93d2001927c6b90fa0b83fe3b0 |
Close
Hashes for snowman_py-0.0.14-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 492eaca69bb9a78e2e30eb30db2fc3e8afc026295ea7bee2ae8cb2ec67115eec |
|
MD5 | efb53437317e2382da36c028daf41dd3 |
|
BLAKE2b-256 | 7b7b4b86f4b1f8634ded38b0606397b307ba5dd5b531cf3f7999d07f8b339755 |
Close
Hashes for snowman_py-0.0.14-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b6570de75fbf653383b9967142b4f76a6dfb0d57a661894eb14625ae2b8a686 |
|
MD5 | 9998f3c3dab773e9fa221b9617a6754e |
|
BLAKE2b-256 | 37acadc49c67445d7638b4a8469e2fc96a75c213bdcffd05878caa912377795a |