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.
Files changed (23) hide show
  1. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/CHANGELOG.md +6 -0
  2. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/PKG-INFO +1 -1
  3. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/pyproject.toml +1 -1
  4. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons/sqlite.py +13 -0
  5. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/PKG-INFO +1 -1
  6. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/tests/test_sqlite.py +9 -1
  7. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/AUTHORS.md +0 -0
  8. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/LICENSE +0 -0
  9. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/MANIFEST.in +0 -0
  10. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/README.md +0 -0
  11. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/Makefile +0 -0
  12. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/conf.py +0 -0
  13. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/index.rst +0 -0
  14. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/doc/make.bat +0 -0
  15. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/setup.cfg +0 -0
  16. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/setup.py +0 -0
  17. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons/__init__.py +0 -0
  18. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons/py.typed +0 -0
  19. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/SOURCES.txt +0 -0
  20. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/dependency_links.txt +0 -0
  21. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/src/sqlalchemy_boltons.egg-info/top_level.txt +0 -0
  22. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/tests/__init__.py +0 -0
  23. {sqlalchemy_boltons-1.0.1 → sqlalchemy_boltons-1.1.0}/tests/conftest.py +0 -0
@@ -4,6 +4,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.1.0] - 2025-03-11
8
+
9
+ ### Changed
10
+
11
+ - `sqlite`: Use an unlimited-size QueuePool by default.
12
+
7
13
  ## [1.0.1] - 2025-02-22
8
14
 
9
15
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlalchemy_boltons
3
- Version: 1.0.1
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>
@@ -3,7 +3,7 @@ line-length = 120
3
3
 
4
4
  [project]
5
5
  name = "sqlalchemy_boltons"
6
- version = "1.0.1"
6
+ version = "1.1.0"
7
7
  description = "Utilities that should've been inside SQLAlchemy but aren't"
8
8
  readme = "README.md"
9
9
  license = { text = "MIT" }
@@ -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 = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlalchemy-boltons
3
- Version: 1.0.1
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(path, journal_mode="WAL", timeout=0.5, create_engine_args={"echo": True})
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):