Skip to content

Release Notes

0.12.0

Fixed

  • Fixed extract_options in SQLAlchemyDatabase popping the wrong key when extracting isolation_level from URL query parameters. The loop variable param retained the value "echo_pool" from the previous iteration, so isolation_level was never actually extracted.
  • Fixed transaction decorator (Transaction.__call__) silently discarding the decorated function's return value. await func(...) is now return await func(...).
  • Fixed force-disconnect cleanup in Database.disconnect() being unreachable dead code. An assert not self._databases_map inside an if self._databases_map: block always fired before the sub-database cleanup loop could execute.
  • Fixed Database._connection property setter returning a value (silently discarded by Python) and having an incorrect -> Connection | None return annotation. Setters are now correctly -> None.
  • Fixed refcount underflow in Database.disconnect() when disconnecting without a prior successful connect, and normalized force-disconnect behavior to reset refcount safely.
  • Fixed transaction lifecycle edge cases where double commit / rollback could underflow connection counters.
  • Fixed out-of-order transaction finalization to raise explicit runtime errors instead of silently continuing.
  • Fixed transaction finalization to still clean up connection state when backend commit/rollback raises.
  • Fixed SQLAlchemyTransaction cleanup paths to always clear backend transaction state and restore previous isolation level on failure paths.
  • Fixed cancellation safety in cross-loop forwarding (arun_coroutine_threadsafe) so cancelled callers also cancel the submitted future.
  • Fixed SQL construction in dbapi2 and jdbc dialect has_table() probes to avoid malformed identifier quoting.
  • Fixed JDBC reflection index sort-order mapping (get_indexes) using the wrong list element for column_sorting.
  • Fixed PostgreSQL overwrite driver auto-upgrade typo ("pscopg2" -> "psycopg2"), restoring expected async driver upgrade behavior.
  • Fixed ASGI lifespan failure messages to use message (ASGI-compatible key) instead of msg.

Changed

  • Narrowed except Exception to except ImportError in TYPE_CHECKING blocks in interfaces.py and core/database.py to avoid masking genuine errors like SyntaxError or AttributeError.
  • Replaced mutable list defaults ["databasez.overwrites"] with immutable tuples ("databasez.overwrites",) in Database.get_backends() and Database.apply_database_url_and_options().
  • Extracted duplicated dialect detection, URL redirection, and AUTOCOMMIT logic in DatabaseTestClient into _resolve_admin_url(), _needs_autocommit(), and _admin_client() helper methods.
  • Tightened type annotations: column: Anycolumn: int | str, template: Anytemplate: str | None.
  • Removed duplicated exception handling block in AsyncWrapper.__getattribute__ (second block was unreachable dead code).
  • Simplified else: raise exc anti-patterns to bare raise in utils.py.
  • Hardened test-database DDL generation by validating charset/encoding names before interpolation.
  • PostgreSQL test-database termination query now binds database name as a parameter instead of interpolating into SQL text.
  • Added focused regression coverage for disconnect/refcount handling, transaction finalization safety, cancellation behavior, SQL quoting paths, and overwrite driver upgrades.

0.11.5

Changed

  • Update internal imports to be compatible with SQLAlchemy 1.4+.

0.11.4

Changed

  • Use monkay.asgi helpers.
  • Bump to Python 3.10+.
  • Reduce noise by removing info log messages when connecting to/disconnecting from a db.

0.11.3

Fixed

  • Excessive and confusing debug logging for overwrite selection.
  • Allow DATABASEZ_POLL_INTERVAL overwrites.

0.11.2

Fixed

  • Ruff calls were using different rulesets.
  • Cleaned up database_exist, drop_database, create_database methods of DatabaseTestClient.
  • Remove dependency on sqlalchemy_utils.
  • Provide get_quoter for retrieving a quote method.

0.11.1

Fixed

  • Python 3.9 compatibility.

0.11.0

Added

  • Add support for jdbc reflection.

0.10.3

Fixed

  • The global connection is now entered lazily despite sub-databases.
  • Fix deadlock with full_isolation off.
  • Fix database.transaction() failing because of AsyncDatabaseHelper.
  • Fix DatabaseTestClient not able to use config initialization.

0.10.2

Fixed

  • Fix transactions in multi-threading contexts.

Changed

  • The transaction stack contains the backend too.

Removed

  • Remove ACTIVE_TRANSACTIONS ContextVar plus tests for it. It became unreliable with multithreading.

0.10.1

Added

  • poll_interval parameter (only relevant when using multithreading).

Fixed

  • Improved thread-safety.
  • full_isolation was not passed through in TestClient.

0.10.0

Added

  • full_isolation parameter. Isolate the force_rollback Connection in a thread.
  • Timeouts for operations.

Fixed

  • batched_iterate interface of Connection differed from the one of Database.
  • iterate interface of Connection differed from the one of Database.
  • Hooks were called on automatically created Database objects.
  • More multithreading safety.

0.9.7

Added

  • It is now possible to use connect(), disconnect() instead of a async contextmanager in multi-loop calls (multithreading).

Fixed

  • Database calls are forwarded to subdatabase when possible. This unbreaks using not the returned database object.
  • force_rollback works also in multi-loop call (multithreading).

0.9.6

Fixed

  • Databasez is now threadsafe (and multiloop safe).

0.9.5

Changed

  • Extract more options by default from query options.

Fixed

  • disconnect_hook was called too early.
  • connect_hook was called too late.
  • pos not passed through in fetch_one.

0.9.4

Changed

  • Implement iterate in sqlalchemy base class (before it was a forward to batched_iterate).

Fixed

  • iterate and batched_iterate misconfigure connection.

0.9.3

Added

  • Add lazy_setup parameter for testclient.
  • disconnect and connect return if they performed the setup/cleanup.
  • Add backward compatible overwrites of defaults to the TestClient.

Fixed

  • Restore eager setup behavior in testclient.
  • Fix drop_dabase with postgresql.
  • Fix setup/disconnect hangups.
  • Fix ancient docs deps.

Removed

  • Dependency on nest_asyncio. It is an archived repo.

0.9.2

Added

  • Expose customization hooks for disconnects, connects.

Fixed

  • Testclient has issues with missing permissions.
  • Lazy global connection.

0.9.1

Added

  • Expose customization hooks for execute result parsing for subclasses of sqlalchemy.

Fixed

  • execute_many works now efficient and properly and returns autoincrement column ids.
  • execute returned not autoincrement id but defaults.

0.9.0

Added

  • force_rollback is now a descriptor returning an extensive ForceRollback object.
    • Setting True, False, None is now possible for overwriting the value/resetting to the initial value (None).
    • Deleting it resets it to the initial value.
    • Its trueness value evaluates to the current value, context-sensitive.
    • It still can be used as a contextmanager for temporary overwrites.

Fixed

  • Fixed refcount for global connections.

Changed

  • connect/disconnect calls are now refcounted. Nesting is now supported.
  • ACTIVE_TRANSACTIONS dict is not replaced anymore when initialized.

0.8.5

Added

  • Allow overwriting force_rollback when copying via passing Database as parameter.

Changed

  • The force_rollback parameter is now None by default.

Fixed

  • Fix typo in Testclient copying path.

0.8.4

Added

  • Provide __copy__ method for Database, DatabaseBackend.
  • Database is now an allowed type for Database (used for copying). Same is true for the DatabaseTestClient subclass.

Fixed

  • Speed of tests.
  • DATABASE_CONFIG_URLS had passwords not properly unquoted.

0.8.3

Added

  • DatabaseTestClient has now an option for changing the test prefix.

Fixed

  • DatabaseTestClient can now use the improvements in 0.8.0 too.
  • DatabaseTestClient is now tested.
  • Fix run_sync on Database objects.

0.8.2

Fixed

  • Cannot pass parameters to execute directly. Bulk_inserts not possible anymore.

0.8.1

Fixed

  • The dbapi2 dialect used only a single thread for all connections.
  • Some options were not translated into query options and vice versa.

0.8.0

Added

  • batched_iterate.
  • jdbc dialect to load nearly all jdbc drivers (note: many features won't work).
  • dbapi2 dialect to load nearly all dbapi2 drivers (note: many features won't work).

Changed

  • Use psycopg3 by default. Autoupgrade postgres:// to postgres+psycopg://. Note: this behavior differs from sqlalchemy which still uses psycopg2 by default.
  • fetch_all uses now iterate as fallback.
  • hatch is now used for release management, cleaning.
  • Use mariadb for tests instead of mysql (resource problems).

Removed

  • aiopg support (no update for 2 years and better alternatives available).
  • Remove Makefile and other scripts.
  • Own run_sync implementation. Use asyncio.run instead.

Fixed

  • docker compose doesn't uses that much resources anymore.

0.7.2

Fixed

  • Regression introduced by asyncio with DatabaseTestClient.

0.7.1

Fixed

  • Fix regression introduced by SQLAlchemy 2.0.25 with make_url.

0.7.0

Fixed

  • urllib.parse.urlsplit was causing the password or username from being properly parsed and split with special characters.

0.6.0

Added

  • Support for Python 3.12

Changed

  • pyodbc version for MSSQL driver.

0.5.0

Fixed

  • Patch done in the core of Databases fixing the concurrent usage of connections and transactions. This patch also affects databases. #PR 546 by @zevisert. We thank @zevisert for the fix done in the original project that also affect Databasez.

0.4.0

Changed

  • Added extra support for unix sockets for mysql and asyncmy. PR #13 by tarsil.
  • Update version of SQLAlchemy.

0.3.0

Changed

  • Upgraded SQLAlchemy to version 2.0.12+ where the BaseRow implementation was redesigned and improved in terms of performance. #10
  • Updated internal Record representation of the returned Row from SQLAlchemy reflecting the performance improvements.

0.2.2

Fixed

  • Bad state when a connection was cancelled.

0.2.1

Fixed

  • Error raised when checking the column mapping for empty columns.

0.2.0

Changed

  • Updated requirements to the latest of sqlalchemy and added support for nest_asyncio.

Added

  • New run_sync function for connections allowing every connection to run blocking operations inside async. For example, a sqlalchemy inspect

0.1.0

Initial release.

This is the official release of databasez where it provides the experience as the one forked from Encode with additional features and improvements.

  • SQLAlchemy 2+ integration.
  • Additonal support for mssql.
  • Connection as dict.
  • Brings a native test client.