fakesnow 0.9.12__py3-none-any.whl → 0.9.13__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/__init__.py +6 -1
- fakesnow/fakes.py +7 -2
- fakesnow/transforms.py +2 -4
- {fakesnow-0.9.12.dist-info → fakesnow-0.9.13.dist-info}/METADATA +2 -2
- {fakesnow-0.9.12.dist-info → fakesnow-0.9.13.dist-info}/RECORD +9 -9
- {fakesnow-0.9.12.dist-info → fakesnow-0.9.13.dist-info}/LICENSE +0 -0
- {fakesnow-0.9.12.dist-info → fakesnow-0.9.13.dist-info}/WHEEL +0 -0
- {fakesnow-0.9.12.dist-info → fakesnow-0.9.13.dist-info}/entry_points.txt +0 -0
- {fakesnow-0.9.12.dist-info → fakesnow-0.9.13.dist-info}/top_level.txt +0 -0
fakesnow/__init__.py
CHANGED
@@ -21,6 +21,7 @@ def patch(
|
|
21
21
|
create_database_on_connect: bool = True,
|
22
22
|
create_schema_on_connect: bool = True,
|
23
23
|
db_path: str | os.PathLike | None = None,
|
24
|
+
nop_regexes: list[str] | None = None,
|
24
25
|
) -> Iterator[None]:
|
25
26
|
"""Patch snowflake targets with fakes.
|
26
27
|
|
@@ -36,8 +37,11 @@ def patch(
|
|
36
37
|
|
37
38
|
create_database_on_connect (bool, optional): Create database if provided in connection. Defaults to True.
|
38
39
|
create_schema_on_connect (bool, optional): Create schema if provided in connection. Defaults to True.
|
39
|
-
db_path (str | os.PathLike | None, optional):
|
40
|
+
db_path (str | os.PathLike | None, optional): Use existing database files from this path
|
40
41
|
or create them here if they don't already exist. If None databases are in-memory. Defaults to None.
|
42
|
+
nop_regexes (list[str] | None, optional): SQL statements matching these regexes (case-insensitive) will return
|
43
|
+
the success response without being run. Useful to skip over SQL commands that aren't implemented yet.
|
44
|
+
Defaults to None.
|
41
45
|
|
42
46
|
Yields:
|
43
47
|
Iterator[None]: None.
|
@@ -57,6 +61,7 @@ def patch(
|
|
57
61
|
create_database=create_database_on_connect,
|
58
62
|
create_schema=create_schema_on_connect,
|
59
63
|
db_path=db_path,
|
64
|
+
nop_regexes=nop_regexes,
|
60
65
|
**kwargs,
|
61
66
|
),
|
62
67
|
snowflake.connector.pandas_tools.write_pandas: fakes.write_pandas,
|
fakesnow/fakes.py
CHANGED
@@ -135,8 +135,11 @@ class FakeSnowflakeCursor:
|
|
135
135
|
print(f"{command};{params=}" if params else f"{command};", file=sys.stderr)
|
136
136
|
|
137
137
|
command, params = self._rewrite_with_params(command, params)
|
138
|
-
|
139
|
-
|
138
|
+
if self._conn.nop_regexes and any(re.match(p, command, re.IGNORECASE) for p in self._conn.nop_regexes):
|
139
|
+
transformed = transforms.SUCCESS_NOP
|
140
|
+
else:
|
141
|
+
expression = parse_one(command, read="snowflake")
|
142
|
+
transformed = self._transform(expression)
|
140
143
|
return self._execute(transformed, params)
|
141
144
|
except snowflake.connector.errors.ProgrammingError as e:
|
142
145
|
self._sqlstate = e.sqlstate
|
@@ -502,6 +505,7 @@ class FakeSnowflakeConnection:
|
|
502
505
|
create_database: bool = True,
|
503
506
|
create_schema: bool = True,
|
504
507
|
db_path: str | os.PathLike | None = None,
|
508
|
+
nop_regexes: list[str] | None = None,
|
505
509
|
*args: Any,
|
506
510
|
**kwargs: Any,
|
507
511
|
):
|
@@ -513,6 +517,7 @@ class FakeSnowflakeConnection:
|
|
513
517
|
self.database_set = False
|
514
518
|
self.schema_set = False
|
515
519
|
self.db_path = db_path
|
520
|
+
self.nop_regexes = nop_regexes
|
516
521
|
self._paramstyle = snowflake.connector.paramstyle
|
517
522
|
|
518
523
|
create_global_database(duck_conn)
|
fakesnow/transforms.py
CHANGED
@@ -1122,12 +1122,10 @@ def timestamp_ntz_ns(expression: exp.Expression) -> exp.Expression:
|
|
1122
1122
|
|
1123
1123
|
if (
|
1124
1124
|
isinstance(expression, exp.DataType)
|
1125
|
-
and expression.this == exp.DataType.Type.
|
1125
|
+
and expression.this == exp.DataType.Type.TIMESTAMPNTZ
|
1126
1126
|
and exp.DataTypeParam(this=exp.Literal(this="9", is_string=False)) in expression.expressions
|
1127
1127
|
):
|
1128
|
-
|
1129
|
-
del new.args["expressions"]
|
1130
|
-
return new
|
1128
|
+
return exp.DataType(this=exp.DataType.Type.TIMESTAMP)
|
1131
1129
|
|
1132
1130
|
return expression
|
1133
1131
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fakesnow
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.13
|
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,7 +213,7 @@ 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.14.0
|
217
217
|
Provides-Extra: dev
|
218
218
|
Requires-Dist: build ~=1.0 ; extra == 'dev'
|
219
219
|
Requires-Dist: pandas-stubs ; extra == 'dev'
|
@@ -1,18 +1,18 @@
|
|
1
|
-
fakesnow/__init__.py,sha256=
|
1
|
+
fakesnow/__init__.py,sha256=7040jPjD-bNJDU4Lel42CD_DU47oeu1IsY9Fx_DlslQ,3799
|
2
2
|
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=q_mTOnNqYdXfrHohTRarGQG1ygh-QXV-7mCptpJ1OQ8,30231
|
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=gQJVehhUXNecnCe8GVC5EM9MBsSPNUHjz9_djUAyJUI,50648
|
13
|
+
fakesnow-0.9.13.dist-info/LICENSE,sha256=kW-7NWIyaRMQiDpryfSmF2DObDZHGR1cJZ39s6B1Svg,11344
|
14
|
+
fakesnow-0.9.13.dist-info/METADATA,sha256=1j1kYYfrf6tztJ24t45oMew6ShCqwnP8VDu00I4sbag,17841
|
15
|
+
fakesnow-0.9.13.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
16
|
+
fakesnow-0.9.13.dist-info/entry_points.txt,sha256=2riAUgu928ZIHawtO8EsfrMEJhi-EH-z_Vq7Q44xKPM,47
|
17
|
+
fakesnow-0.9.13.dist-info/top_level.txt,sha256=500evXI1IFX9so82cizGIEMHAb_dJNPaZvd2H9dcKTA,24
|
18
|
+
fakesnow-0.9.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|