fakesnow 0.9.15__tar.gz → 0.9.16__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.9.15 → fakesnow-0.9.16}/PKG-INFO +1 -1
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/fakes.py +2 -2
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow.egg-info/PKG-INFO +1 -1
- {fakesnow-0.9.15 → fakesnow-0.9.16}/pyproject.toml +1 -1
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_fakes.py +6 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/LICENSE +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/README.md +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/__init__.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/__main__.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/checks.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/cli.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/expr.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/fixtures.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/global_database.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/info_schema.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/macros.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/py.typed +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow/transforms.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow.egg-info/SOURCES.txt +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow.egg-info/dependency_links.txt +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow.egg-info/entry_points.txt +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow.egg-info/requires.txt +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/fakesnow.egg-info/top_level.txt +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/setup.cfg +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_checks.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_cli.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_expr.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_info_schema.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_patch.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_sqlalchemy.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_transforms.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_users.py +0 -0
- {fakesnow-0.9.15 → fakesnow-0.9.16}/tests/test_write_pandas.py +0 -0
@@ -520,7 +520,7 @@ class FakeSnowflakeConnection:
|
|
520
520
|
self.schema = schema and schema.upper()
|
521
521
|
self.database_set = False
|
522
522
|
self.schema_set = False
|
523
|
-
self.db_path = db_path
|
523
|
+
self.db_path = Path(db_path) if db_path else None
|
524
524
|
self.nop_regexes = nop_regexes
|
525
525
|
self._paramstyle = snowflake.connector.paramstyle
|
526
526
|
|
@@ -535,7 +535,7 @@ class FakeSnowflakeConnection:
|
|
535
535
|
where catalog_name = '{self.database}'"""
|
536
536
|
).fetchone()
|
537
537
|
):
|
538
|
-
db_file = f"{
|
538
|
+
db_file = f"{self.db_path/self.database}.db" if self.db_path else ":memory:"
|
539
539
|
duck_conn.execute(f"ATTACH DATABASE '{db_file}' AS {self.database}")
|
540
540
|
duck_conn.execute(info_schema.creation_sql(self.database))
|
541
541
|
duck_conn.execute(macros.creation_sql(self.database))
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fakesnow"
|
3
3
|
description = "Fake Snowflake Connector for Python. Run, mock and test Snowflake DB locally."
|
4
|
-
version = "0.9.
|
4
|
+
version = "0.9.16"
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
7
7
|
classifiers = ["License :: OSI Approved :: MIT License"]
|
@@ -202,6 +202,12 @@ def test_connect_reuse_db():
|
|
202
202
|
assert cur.execute("select * from example").fetchall() == [(420,)]
|
203
203
|
|
204
204
|
|
205
|
+
def test_connect_db_path_can_create_database() -> None:
|
206
|
+
with tempfile.TemporaryDirectory(prefix="fakesnow-test") as db_path, fakesnow.patch(db_path=db_path):
|
207
|
+
cursor = snowflake.connector.connect().cursor()
|
208
|
+
cursor.execute("CREATE DATABASE db2")
|
209
|
+
|
210
|
+
|
205
211
|
def test_connect_without_database(_fakesnow_no_auto_create: None):
|
206
212
|
with snowflake.connector.connect() as conn, conn.cursor() as cur:
|
207
213
|
with pytest.raises(snowflake.connector.errors.ProgrammingError) as excinfo:
|
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
|
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
|