fakesnow 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fakesnow-0.6.0/fakesnow.egg-info → fakesnow-0.7.0}/PKG-INFO +5 -1
- {fakesnow-0.6.0 → fakesnow-0.7.0}/README.md +4 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/info_schema.py +19 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0/fakesnow.egg-info}/PKG-INFO +5 -1
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow.egg-info/SOURCES.txt +0 -1
- {fakesnow-0.6.0 → fakesnow-0.7.0}/pyproject.toml +12 -9
- {fakesnow-0.6.0 → fakesnow-0.7.0}/tests/test_fakes.py +22 -2
- fakesnow-0.6.0/setup.py +0 -4
- {fakesnow-0.6.0 → fakesnow-0.7.0}/LICENSE +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/MANIFEST.in +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/__init__.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/checks.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/expr.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/fakes.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/fixtures.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/py.typed +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow/transforms.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow.egg-info/dependency_links.txt +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow.egg-info/requires.txt +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/fakesnow.egg-info/top_level.txt +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/setup.cfg +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/tests/test_checks.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/tests/test_expr.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/tests/test_patch.py +0 -0
- {fakesnow-0.6.0 → fakesnow-0.7.0}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fakesnow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.0
|
4
4
|
Summary: Fake Snowflake Connector for Python. Run Snowflake DB locally.
|
5
5
|
License: MIT License
|
6
6
|
|
@@ -129,6 +129,10 @@ Partial support
|
|
129
129
|
|
130
130
|
For more detail see [tests/test_fakes.py](tests/test_fakes.py)
|
131
131
|
|
132
|
+
## Caveats
|
133
|
+
|
134
|
+
- VARCHAR field sizes are not enforced unlike Snowflake which will error with "User character length limit (xxx) exceeded by string" when you try to insert a string longer than the column limit.
|
135
|
+
|
132
136
|
## Contributing
|
133
137
|
|
134
138
|
See [CONTRIBUTING.md](CONTRIBUTING.md) to get started and develop in this repo.
|
@@ -95,6 +95,10 @@ Partial support
|
|
95
95
|
|
96
96
|
For more detail see [tests/test_fakes.py](tests/test_fakes.py)
|
97
97
|
|
98
|
+
## Caveats
|
99
|
+
|
100
|
+
- VARCHAR field sizes are not enforced unlike Snowflake which will error with "User character length limit (xxx) exceeded by string" when you try to insert a string longer than the column limit.
|
101
|
+
|
98
102
|
## Contributing
|
99
103
|
|
100
104
|
See [CONTRIBUTING.md](CONTRIBUTING.md) to get started and develop in this repo.
|
@@ -59,12 +59,31 @@ AND ext_table_name = table_name AND ext_column_name = column_name
|
|
59
59
|
"""
|
60
60
|
)
|
61
61
|
|
62
|
+
# replicates https://docs.snowflake.com/sql-reference/info-schema/databases
|
63
|
+
SQL_CREATE_INFORMATION_SCHEMA_DATABASES_VIEW = Template(
|
64
|
+
"""
|
65
|
+
create view ${catalog}.information_schema.databases AS
|
66
|
+
select
|
67
|
+
catalog_name as database_name,
|
68
|
+
'SYSADMIN' as database_owner,
|
69
|
+
'NO' as is_transient,
|
70
|
+
null as comment,
|
71
|
+
to_timestamp(0)::timestamptz as created,
|
72
|
+
to_timestamp(0)::timestamptz as last_altered,
|
73
|
+
1 as retention_time,
|
74
|
+
'STANDARD' as type
|
75
|
+
from information_schema.schemata
|
76
|
+
where catalog_name not in ('memory', 'system', 'temp') and schema_name = 'information_schema'
|
77
|
+
"""
|
78
|
+
)
|
79
|
+
|
62
80
|
|
63
81
|
def creation_sql(catalog: str) -> str:
|
64
82
|
return f"""
|
65
83
|
{SQL_CREATE_INFORMATION_SCHEMA_TABLES_EXT.substitute(catalog=catalog)};
|
66
84
|
{SQL_CREATE_INFORMATION_SCHEMA_COLUMNS_EXT.substitute(catalog=catalog)};
|
67
85
|
{SQL_CREATE_INFORMATION_SCHEMA_COLUMNS_VIEW.substitute(catalog=catalog)};
|
86
|
+
{SQL_CREATE_INFORMATION_SCHEMA_DATABASES_VIEW.substitute(catalog=catalog)};
|
68
87
|
"""
|
69
88
|
|
70
89
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fakesnow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.0
|
4
4
|
Summary: Fake Snowflake Connector for Python. Run Snowflake DB locally.
|
5
5
|
License: MIT License
|
6
6
|
|
@@ -129,6 +129,10 @@ Partial support
|
|
129
129
|
|
130
130
|
For more detail see [tests/test_fakes.py](tests/test_fakes.py)
|
131
131
|
|
132
|
+
## Caveats
|
133
|
+
|
134
|
+
- VARCHAR field sizes are not enforced unlike Snowflake which will error with "User character length limit (xxx) exceeded by string" when you try to insert a string longer than the column limit.
|
135
|
+
|
132
136
|
## Contributing
|
133
137
|
|
134
138
|
See [CONTRIBUTING.md](CONTRIBUTING.md) to get started and develop in this repo.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fakesnow"
|
3
3
|
description = "Fake Snowflake Connector for Python. Run Snowflake DB locally."
|
4
|
-
version = "0.
|
4
|
+
version = "0.7.0"
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
7
7
|
classifiers = ["License :: OSI Approved :: MIT License"]
|
@@ -32,7 +32,7 @@ dev = [
|
|
32
32
|
notebook = ["duckdb-engine", "ipykernel", "jupysql", "snowflake-sqlalchemy"]
|
33
33
|
|
34
34
|
[build-system]
|
35
|
-
requires = ["setuptools~=67.
|
35
|
+
requires = ["setuptools~=67.7", "wheel~=0.40"]
|
36
36
|
|
37
37
|
[tool.setuptools.packages.find]
|
38
38
|
where = ["."]
|
@@ -42,11 +42,14 @@ exclude = ["tests*"]
|
|
42
42
|
[tool.black]
|
43
43
|
line-length = 120
|
44
44
|
|
45
|
-
[tool.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
[tool.pyright]
|
46
|
+
venvPath = "."
|
47
|
+
venv = ".venv"
|
48
|
+
exclude = ["**/node_modules", "**/__pycache__", "**/.*", "build"]
|
49
|
+
strictListInference = true
|
50
|
+
strictDictionaryInference = true
|
51
|
+
strictParameterNoneValue = true
|
52
|
+
reportTypedDictNotRequiredAccess = false
|
50
53
|
|
51
54
|
[tool.ruff]
|
52
55
|
line-length = 120
|
@@ -80,8 +83,6 @@ ignore = [
|
|
80
83
|
"ANN204",
|
81
84
|
# allow == True because pandas dataframes overload equality
|
82
85
|
"E712",
|
83
|
-
# only relevant for python >= 3.10
|
84
|
-
"B905",
|
85
86
|
]
|
86
87
|
# first-party imports for sorting
|
87
88
|
src = ["."]
|
@@ -89,6 +90,8 @@ fix = true
|
|
89
90
|
show-fixes = true
|
90
91
|
|
91
92
|
[tool.ruff.per-file-ignores]
|
93
|
+
# imports in __init__.py don't need to be used in __init__.py
|
94
|
+
"__init__.py" = ["F401"]
|
92
95
|
# test functions don't need return types
|
93
96
|
"tests/*" = ["ANN201", "ANN202"]
|
94
97
|
|
@@ -51,7 +51,7 @@ def test_binding_qmark(conn: snowflake.connector.SnowflakeConnection):
|
|
51
51
|
|
52
52
|
def test_connect_auto_create(_fakesnow: None):
|
53
53
|
with snowflake.connector.connect(database="db1", schema="schema1"):
|
54
|
-
# creates
|
54
|
+
# creates db1 and schema1
|
55
55
|
pass
|
56
56
|
|
57
57
|
with snowflake.connector.connect(database="db1", schema="schema1"):
|
@@ -248,7 +248,7 @@ def test_describe(cur: snowflake.connector.cursor.SnowflakeCursor):
|
|
248
248
|
assert cur.description == expected_metadata
|
249
249
|
|
250
250
|
|
251
|
-
def
|
251
|
+
def test_describe_info_schema_columns(cur: snowflake.connector.cursor.SnowflakeCursor):
|
252
252
|
# test we can handle the column types returned from the info schema, which are created by duckdb
|
253
253
|
# and so don't go through our transforms
|
254
254
|
cur.execute("select column_name, ordinal_position from information_schema.columns")
|
@@ -467,6 +467,26 @@ def test_information_schema_columns_text(cur: snowflake.connector.cursor.Snowfla
|
|
467
467
|
]
|
468
468
|
|
469
469
|
|
470
|
+
def test_information_schema_databases(conn: snowflake.connector.SnowflakeConnection):
|
471
|
+
# see https://docs.snowflake.com/en/sql-reference/info-schema/databases
|
472
|
+
|
473
|
+
with conn.cursor(snowflake.connector.cursor.DictCursor) as cur:
|
474
|
+
cur.execute("select * from information_schema.databases")
|
475
|
+
|
476
|
+
assert cur.fetchall() == [
|
477
|
+
{
|
478
|
+
"database_name": "DB1",
|
479
|
+
"database_owner": "SYSADMIN",
|
480
|
+
"is_transient": "NO",
|
481
|
+
"comment": None,
|
482
|
+
"created": datetime.datetime(1970, 1, 1, 0, 0, tzinfo=pytz.utc),
|
483
|
+
"last_altered": datetime.datetime(1970, 1, 1, 0, 0, tzinfo=pytz.utc),
|
484
|
+
"retention_time": 1,
|
485
|
+
"type": "STANDARD",
|
486
|
+
},
|
487
|
+
]
|
488
|
+
|
489
|
+
|
470
490
|
def test_non_existent_table_throws_snowflake_exception(cur: snowflake.connector.cursor.SnowflakeCursor):
|
471
491
|
with pytest.raises(snowflake.connector.errors.ProgrammingError) as _:
|
472
492
|
cur.execute("select * from this_table_does_not_exist")
|
fakesnow-0.6.0/setup.py
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|