fakesnow 0.9.8__py3-none-any.whl → 0.9.10__py3-none-any.whl
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/fakes.py +1 -0
- fakesnow/transforms.py +35 -5
- {fakesnow-0.9.8.dist-info → fakesnow-0.9.10.dist-info}/METADATA +3 -3
- {fakesnow-0.9.8.dist-info → fakesnow-0.9.10.dist-info}/RECORD +8 -8
- {fakesnow-0.9.8.dist-info → fakesnow-0.9.10.dist-info}/LICENSE +0 -0
- {fakesnow-0.9.8.dist-info → fakesnow-0.9.10.dist-info}/WHEEL +0 -0
- {fakesnow-0.9.8.dist-info → fakesnow-0.9.10.dist-info}/entry_points.txt +0 -0
- {fakesnow-0.9.8.dist-info → fakesnow-0.9.10.dist-info}/top_level.txt +0 -0
fakesnow/fakes.py
CHANGED
fakesnow/transforms.py
CHANGED
@@ -55,6 +55,27 @@ def array_agg_within_group(expression: exp.Expression) -> exp.Expression:
|
|
55
55
|
return expression
|
56
56
|
|
57
57
|
|
58
|
+
def create_clone(expression: exp.Expression) -> exp.Expression:
|
59
|
+
"""Transform create table clone to create table as select."""
|
60
|
+
|
61
|
+
if (
|
62
|
+
isinstance(expression, exp.Create)
|
63
|
+
and str(expression.args.get("kind")).upper() == "TABLE"
|
64
|
+
and (clone := expression.find(exp.Clone))
|
65
|
+
):
|
66
|
+
return exp.Create(
|
67
|
+
this=expression.this,
|
68
|
+
kind="TABLE",
|
69
|
+
expression=exp.Select(
|
70
|
+
expressions=[
|
71
|
+
exp.Star(),
|
72
|
+
],
|
73
|
+
**{"from": exp.From(this=clone.this)},
|
74
|
+
),
|
75
|
+
)
|
76
|
+
return expression
|
77
|
+
|
78
|
+
|
58
79
|
# TODO: move this into a Dialect as a transpilation
|
59
80
|
def create_database(expression: exp.Expression, db_path: Path | None = None) -> exp.Expression:
|
60
81
|
"""Transform create database to attach database.
|
@@ -309,7 +330,7 @@ def extract_comment_on_table(expression: exp.Expression) -> exp.Expression:
|
|
309
330
|
if props := cast(exp.Properties, expression.args.get("properties")):
|
310
331
|
other_props = []
|
311
332
|
for p in props.expressions:
|
312
|
-
if isinstance(p, exp.SchemaCommentProperty) and (isinstance(p.this, (exp.Literal, exp.
|
333
|
+
if isinstance(p, exp.SchemaCommentProperty) and (isinstance(p.this, (exp.Literal, exp.Var))):
|
313
334
|
comment = p.this.this
|
314
335
|
else:
|
315
336
|
other_props.append(p)
|
@@ -360,10 +381,19 @@ def extract_text_length(expression: exp.Expression) -> exp.Expression:
|
|
360
381
|
|
361
382
|
if isinstance(expression, (exp.Create, exp.AlterTable)):
|
362
383
|
text_lengths = []
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
384
|
+
|
385
|
+
# exp.Select is for a ctas, exp.Schema is a plain definition
|
386
|
+
if cols := expression.find(exp.Select, exp.Schema):
|
387
|
+
expressions = cols.expressions
|
388
|
+
else:
|
389
|
+
# alter table
|
390
|
+
expressions = expression.args.get("actions") or []
|
391
|
+
for e in expressions:
|
392
|
+
if dts := [
|
393
|
+
dt for dt in e.find_all(exp.DataType) if dt.this in (exp.DataType.Type.VARCHAR, exp.DataType.Type.TEXT)
|
394
|
+
]:
|
395
|
+
col_name = e.alias if isinstance(e, exp.Alias) else e.name
|
396
|
+
if len(dts) == 1 and (dt_size := dts[0].find(exp.DataTypeParam)):
|
367
397
|
size = (
|
368
398
|
isinstance(dt_size.this, exp.Literal)
|
369
399
|
and isinstance(dt_size.this.this, str)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fakesnow
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.10
|
4
4
|
Summary: Fake Snowflake Connector for Python. Run, mock and test Snowflake DB locally.
|
5
5
|
License: Apache License
|
6
6
|
Version 2.0, January 2004
|
@@ -213,14 +213,14 @@ License-File: LICENSE
|
|
213
213
|
Requires-Dist: duckdb ~=0.10.0
|
214
214
|
Requires-Dist: pyarrow
|
215
215
|
Requires-Dist: snowflake-connector-python
|
216
|
-
Requires-Dist: sqlglot ~=23.
|
216
|
+
Requires-Dist: sqlglot ~=23.12.2
|
217
217
|
Provides-Extra: dev
|
218
218
|
Requires-Dist: build ~=1.0 ; extra == 'dev'
|
219
219
|
Requires-Dist: pandas-stubs ; extra == 'dev'
|
220
220
|
Requires-Dist: snowflake-connector-python[pandas,secure-local-storage] ; extra == 'dev'
|
221
221
|
Requires-Dist: pre-commit ~=3.4 ; extra == 'dev'
|
222
222
|
Requires-Dist: pytest ~=8.0 ; extra == 'dev'
|
223
|
-
Requires-Dist: ruff ~=0.
|
223
|
+
Requires-Dist: ruff ~=0.4.2 ; extra == 'dev'
|
224
224
|
Requires-Dist: twine ~=5.0 ; extra == 'dev'
|
225
225
|
Requires-Dist: snowflake-sqlalchemy ~=1.5.0 ; extra == 'dev'
|
226
226
|
Provides-Extra: notebook
|
@@ -3,16 +3,16 @@ fakesnow/__main__.py,sha256=GDrGyNTvBFuqn_UfDjKs7b3LPtU6gDv1KwosVDrukIM,76
|
|
3
3
|
fakesnow/checks.py,sha256=-QMvdcrRbhN60rnzxLBJ0IkUBWyLR8gGGKKmCS0w9mA,2383
|
4
4
|
fakesnow/cli.py,sha256=9qfI-Ssr6mo8UmIlXkUAOz2z2YPBgDsrEVaZv9FjGFs,2201
|
5
5
|
fakesnow/expr.py,sha256=CAxuYIUkwI339DQIBzvFF0F-m1tcVGKEPA5rDTzmH9A,892
|
6
|
-
fakesnow/fakes.py,sha256=
|
6
|
+
fakesnow/fakes.py,sha256=dvbla_iiDIQRtEhaGksMS35WeSG5JSGMhWRaM0VApxg,29490
|
7
7
|
fakesnow/fixtures.py,sha256=G-NkVeruSQAJ7fvSS2fR2oysUn0Yra1pohHlOvacKEk,455
|
8
8
|
fakesnow/global_database.py,sha256=WTVIP1VhNvdCeX7TQncX1TRpGQU5rBf5Pbxim40zeSU,1399
|
9
9
|
fakesnow/info_schema.py,sha256=CdIcGXHEQ_kmEAzdQKvA-PX41LA6wlK-4p1J45qgKYA,6266
|
10
10
|
fakesnow/macros.py,sha256=pX1YJDnQOkFJSHYUjQ6ErEkYIKvFI6Ncz_au0vv1csA,265
|
11
11
|
fakesnow/py.typed,sha256=B-DLSjYBi7pkKjwxCSdpVj2J02wgfJr-E7B1wOUyxYU,80
|
12
|
-
fakesnow/transforms.py,sha256=
|
13
|
-
fakesnow-0.9.
|
14
|
-
fakesnow-0.9.
|
15
|
-
fakesnow-0.9.
|
16
|
-
fakesnow-0.9.
|
17
|
-
fakesnow-0.9.
|
18
|
-
fakesnow-0.9.
|
12
|
+
fakesnow/transforms.py,sha256=oFNMsWygVz5-B98HMnrWznlxJoxl-DwoVCTdwHSdK_0,50670
|
13
|
+
fakesnow-0.9.10.dist-info/LICENSE,sha256=kW-7NWIyaRMQiDpryfSmF2DObDZHGR1cJZ39s6B1Svg,11344
|
14
|
+
fakesnow-0.9.10.dist-info/METADATA,sha256=VrrY4vTMyWNkvmQexDPVmet4WM0jIbxs2e2YBDf3C20,17833
|
15
|
+
fakesnow-0.9.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
16
|
+
fakesnow-0.9.10.dist-info/entry_points.txt,sha256=2riAUgu928ZIHawtO8EsfrMEJhi-EH-z_Vq7Q44xKPM,47
|
17
|
+
fakesnow-0.9.10.dist-info/top_level.txt,sha256=500evXI1IFX9so82cizGIEMHAb_dJNPaZvd2H9dcKTA,24
|
18
|
+
fakesnow-0.9.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|