sqlalchemy-boltons 1.0.1__tar.gz → 1.1.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.
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/CHANGELOG.md +6 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/PKG-INFO +1 -1
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/pyproject.toml +1 -1
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons/sqlite.py +13 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/PKG-INFO +1 -1
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/tests/test_sqlite.py +9 -1
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/AUTHORS.md +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/LICENSE +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/MANIFEST.in +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/README.md +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/Makefile +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/conf.py +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/index.rst +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/make.bat +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/setup.cfg +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/setup.py +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons/__init__.py +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons/py.typed +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/SOURCES.txt +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/dependency_links.txt +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/top_level.txt +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/tests/__init__.py +0 -0
- {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/tests/conftest.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlalchemy_boltons
|
3
|
-
Version: 1.0
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: Utilities that should've been inside SQLAlchemy but aren't
|
5
5
|
Author-email: Eduard Christian Dumitrescu <eduard.c.dumitrescu@gmail.com>
|
6
6
|
Maintainer-email: Eduard Christian Dumitrescu <eduard.c.dumitrescu@gmail.com>
|
@@ -54,6 +54,16 @@ class SQLAlchemySqliteTransactionFix:
|
|
54
54
|
This class exists because sqlalchemy doesn't automatically fix pysqlite's stupid default behaviour. Additionally,
|
55
55
|
we implement support for foreign keys.
|
56
56
|
|
57
|
+
The execution options we look for are as follows:
|
58
|
+
|
59
|
+
- `x_sqlite_begin_mode`: The type of transaction to be started, such as "BEGIN" or
|
60
|
+
"[BEGIN IMMEDIATE](https://www.sqlite.org/lang_transaction.html)" (or
|
61
|
+
"[BEGIN CONCURRENT](https://www.sqlite.org/cgi/src/doc/begin-concurrent/doc/begin_concurrent.md)" someday maybe).
|
62
|
+
- `x_sqlite_foreign_keys`: The [foreign-key enforcement setting](https://www.sqlite.org/foreignkeys.html). Must be
|
63
|
+
`True`, `False`, or `"defer"`.
|
64
|
+
- `x_sqlite_journal_mode`: The [journal mode](https://www.sqlite.org/pragma.html#pragma_journal_mode) such as
|
65
|
+
`"DELETE"` or `"WAL"`. Optional.
|
66
|
+
|
57
67
|
https://docs.sqlalchemy.org/en/20/dialects/sqlite.html#serializable-isolation-savepoints-transactional-ddl
|
58
68
|
"""
|
59
69
|
|
@@ -188,6 +198,9 @@ def create_engine_sqlite(
|
|
188
198
|
# always default to QueuePool
|
189
199
|
if (k := "poolclass") not in create_engine_args:
|
190
200
|
create_engine_args[k] = sap.QueuePool
|
201
|
+
if (k := "max_overflow") not in create_engine_args:
|
202
|
+
# for SQLite it doesn't make sense to restrict the number of concurrent (read-only) connections
|
203
|
+
create_engine_args["max_overflow"] = -1
|
191
204
|
|
192
205
|
if (v := create_engine_args.get(k := "connect_args")) is None:
|
193
206
|
create_engine_args[k] = v = {}
|
{sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlalchemy-boltons
|
3
|
-
Version: 1.0
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: Utilities that should've been inside SQLAlchemy but aren't
|
5
5
|
Author-email: Eduard Christian Dumitrescu <eduard.c.dumitrescu@gmail.com>
|
6
6
|
Maintainer-email: Eduard Christian Dumitrescu <eduard.c.dumitrescu@gmail.com>
|
@@ -54,7 +54,9 @@ def simple_sqlite_engine(tmp_path, database_type):
|
|
54
54
|
else:
|
55
55
|
raise AssertionError
|
56
56
|
|
57
|
-
return _sq.create_engine_sqlite(
|
57
|
+
return _sq.create_engine_sqlite(
|
58
|
+
path, journal_mode="WAL", timeout=0.5, create_engine_args={"echo": True, "pool_timeout": 2}
|
59
|
+
)
|
58
60
|
|
59
61
|
|
60
62
|
@pytest.mark.parametrize("database_type", ["file", "memory"])
|
@@ -117,6 +119,12 @@ def test_transaction(simple_sqlite_engine, database_type):
|
|
117
119
|
assert len(s.execute(sa.select(Example)).all()) == 2
|
118
120
|
s.commit()
|
119
121
|
|
122
|
+
with contextlib.ExitStack() as exit_stack:
|
123
|
+
# concurrent connection count
|
124
|
+
for i in range(30):
|
125
|
+
exit_stack.enter_context(s := SessionR())
|
126
|
+
assert len(s.execute(sa.select(Example)).all()) == 2
|
127
|
+
|
120
128
|
|
121
129
|
@pytest.mark.parametrize("path_type", ["str", "Path"])
|
122
130
|
def test_create_engine_path(tmp_path, path_type):
|
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
|
{sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|