Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zevisert/databases
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: encode/databases
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 16 commits
  • 26 files changed
  • 10 contributors

Commits on May 24, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ab5eb71 View commit details

Commits on Jul 12, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    71ea4ad View commit details
  2. Bump starlette from 0.20.4 to 0.27.0 (encode#560)

    * Bump starlette from 0.20.4 to 0.27.0
    
    Bumps [starlette](https://github.com/encode/starlette) from 0.20.4 to 0.27.0.
    - [Release notes](https://github.com/encode/starlette/releases)
    - [Changelog](https://github.com/encode/starlette/blob/master/docs/release-notes.md)
    - [Commits](encode/starlette@0.20.4...0.27.0)
    
    ---
    updated-dependencies:
    - dependency-name: starlette
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    * Add httpx as dependency
    
    ---------
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Zanie <[email protected]>
    dependabot[bot] and zanieb authored Jul 12, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f3f0c6f View commit details
  3. Bump requests from 2.28.1 to 2.31.0 (encode#562)

    Bumps [requests](https://github.com/psf/requests) from 2.28.1 to 2.31.0.
    - [Release notes](https://github.com/psf/requests/releases)
    - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
    - [Commits](psf/requests@v2.28.1...v2.31.0)
    
    ---
    updated-dependencies:
    - dependency-name: requests
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 12, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c095428 View commit details

Commits on Jul 25, 2023

  1. fix: incorrect concurrent usage of connection and transaction (encode…

    …#546)
    
    * fix: incorrect concurrent usage of connection and transaction
    
    * refactor: rename contextvar class attributes, add some explaination comments
    
    * fix: contextvar.get takes no keyword arguments
    
    * test: add concurrent task tests
    
    * feat: use ContextVar[dict] to track connections and transactions per task
    
    * test: check multiple databases in the same task use independant connections
    
    * chore: changes for linting and typechecking
    
    * chore: use typing.Tuple for lower python version compatibility
    
    * docs: update comment on _connection_contextmap
    
    * Update `Connection` and `Transaction` to be robust to concurrent use
    
    * chore: remove optional annotation on asyncio.Task
    
    * test: add new tests for upcoming contextvar inheritance/isolation and weakref cleanup
    
    * feat: reimplement concurrency system with contextvar and weakmap
    
    * chore: apply corrections from linters
    
    * fix: quote WeakKeyDictionary typing for python<=3.7
    
    * docs: add examples for async transaction context and nested transactions
    
    * fix: remove connection inheritance, add more tests, update docs
    
    Connections are once again stored as state on the Database instance,
    keyed by the current asyncio.Task. Each task acquires it's own
    connection, and a WeakKeyDictionary allows the connection to be
    discarded if the owning task is garbage collected. TransactionBackends
    are still stored as contextvars, and a connection must be explicitly
    provided to descendant tasks if active transaction state is to be
    inherited.
    
    ---------
    
    Co-authored-by: Zanie <[email protected]>
    zevisert and zanieb authored Jul 25, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    25fa295 View commit details

Commits on Aug 2, 2023

  1. Allow SQLite query parameters and support cached databases (encode#561)

    * add support for sqlite connection string query parameters, cached memory databases
    
    * add additional comments encode#196
    
    * tweaked comments encode#196
    
    * Lint
    
    ---------
    
    Co-authored-by: Nathan Joshi <[email protected]>
    zanieb and Nathan Joshi authored Aug 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9795187 View commit details

Commits on Aug 28, 2023

  1. chore: release 0.8.0 prep (encode#565)

    * chore: update changelog for 0.8.0
    
    * Add release date to changelog (tomorrow)
    
    * Move concurrent pull request to changes
    
    ---------
    
    Co-authored-by: Zanie Blue <[email protected]>
    zevisert and zanieb authored Aug 28, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d653b31 View commit details

Commits on Aug 29, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    27c1699 View commit details

Commits on Aug 30, 2023

  1. Fix flaky tests with in-memory SQLite databases (encode#569)

    * Run garbage collection before asserting SQLite database is cleared in test
    
    * Use unique in-memory database name for each SQLite test
    
    * Run garbage collection after every test
    zanieb authored Aug 30, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d047d40 View commit details

Commits on Sep 9, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2d05618 View commit details

Commits on Nov 28, 2023

  1. enabler(backends): allow ssl string parameters in PostgreSQL URL (enc…

    …ode#575) (encode#576)
    
    The underlying library asyncpg accepts string values in the ssl
    parameter. The old code only accepted the values true and false, which
    are converted to boolean.
    Exagone313 authored Nov 28, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c2e4c5b View commit details

Commits on Feb 21, 2024

  1. 🪛 Moving to SQLAlchemy 2.0 (encode#540)

    * 🪛 Added support for SQLAlchemy 2.0
    * Added common and dialects packages to handle
    the new SQLAlchemy 2.0+
    * 🪲 Fix specific asyncpg oriented test
    ---------
    
    Co-authored-by: ansipunk <[email protected]>
    tarsil and ansipunk authored Feb 21, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1e40ad1 View commit details

Commits on Feb 22, 2024

  1. Fix some column types being parsed twice (encode#582)

    * Fix JSON and enum type columns
    * Add time to reparsing check, add date and time tests
    * Make processed types inclusive rather than exclusive, limit to just DIALECT_EXCLUDE
    pmdevita authored Feb 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0fc16b2 View commit details
  2. Support Python 3.12 (encode#583)

    * Python support
    
    * Remove support for Python 3.7
    * Add support for Python 3.12
    
    * Replace psycopg2-binary with psycopg
    
    * Bump requirements.txt versions
    
    * Add setuptools as requirement
    tarsil authored Feb 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b273cd9 View commit details
  3. Bump starlette from 0.27.0 to 0.36.2 (encode#581)

    Bumps [starlette](https://github.com/encode/starlette) from 0.27.0 to 0.36.2.
    - [Release notes](https://github.com/encode/starlette/releases)
    - [Changelog](https://github.com/encode/starlette/blob/master/docs/release-notes.md)
    - [Commits](encode/starlette@0.27.0...0.36.2)
    
    ---
    updated-dependencies:
    - dependency-name: starlette
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    40079f9 View commit details

Commits on Mar 1, 2024

  1. Release 0.9.0 (encode#584)

    * Release 0.9.0
    tarsil authored Mar 1, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ae3fb16 View commit details
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: 3.7
python-version: 3.8
- name: "Install dependencies"
run: "scripts/install"
- name: "Build package & docs"
2 changes: 1 addition & 1 deletion .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

services:
mysql:
178 changes: 140 additions & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,123 +4,225 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 0.9.0 (February 23th, 2024)

### Changed

* Drop support for Python 3.7 and add support for Python 3.12 ([#583][#583])
* Add support for SQLAlchemy 2+ ([#540][#540])
* Allow SSL string parameters in PostgresSQL URL ([#575][#575]) and ([#576][#576])

[#583]: https://github.com/encode/databases/pull/583
[#540]: https://github.com/encode/databases/pull/540
[#575]: https://github.com/encode/databases/pull/575
[#576]: https://github.com/encode/databases/pull/576

## 0.8.0 (August 28th, 2023)

### Added

* Allow SQLite query parameters and support cached databases ([#561][#561])
* Support for unix socket for aiomysql and asyncmy ([#551][#551])

[#551]: https://github.com/encode/databases/pull/551
[#561]: https://github.com/encode/databases/pull/546

### Changed

* Change isolation connections and transactions during concurrent usage ([#546][#546])
* Bump requests from 2.28.1 to 2.31.0 ([#562][#562])
* Bump starlette from 0.20.4 to 0.27.0 ([#560][#560])
* Bump up asyncmy version to fix `No module named 'asyncmy.connection'` ([#553][#553])
* Bump wheel from 0.37.1 to 0.38.1 ([#524][#524])

[#546]: https://github.com/encode/databases/pull/546
[#562]: https://github.com/encode/databases/pull/562
[#560]: https://github.com/encode/databases/pull/560
[#553]: https://github.com/encode/databases/pull/553
[#524]: https://github.com/encode/databases/pull/524

### Fixed

* Fix the type-hints using more standard mode ([#526][#526])

[#526]: https://github.com/encode/databases/pull/526

## 0.7.0 (Dec 18th, 2022)

### Fixed

* Fixed breaking changes in SQLAlchemy cursor; supports `>=1.4.42,<1.5` (#513).
* Wrapped types in `typing.Optional` where applicable (#510).
* Fixed breaking changes in SQLAlchemy cursor; supports `>=1.4.42,<1.5` ([#513][#513])
* Wrapped types in `typing.Optional` where applicable ([#510][#510])

[#513]: https://github.com/encode/databases/pull/513
[#510]: https://github.com/encode/databases/pull/510

## 0.6.2 (Nov 7th, 2022)

### Changed

* Pinned SQLAlchemy `<=1.4.41` to avoid breaking changes (#520).
* Pinned SQLAlchemy `<=1.4.41` to avoid breaking changes ([#520][#520])

[#520]: https://github.com/encode/databases/pull/520

## 0.6.1 (Aug 9th, 2022)

### Fixed

* Improve typing for `Transaction` (#493)
* Allow string indexing into Record (#501)
* Improve typing for `Transaction` ([#493][#493])
* Allow string indexing into Record ([#501][#501])

[#493]: https://github.com/encode/databases/pull/493
[#501]: https://github.com/encode/databases/pull/501

## 0.6.0 (May 29th, 2022)

* Dropped Python 3.6 support (#458)
* Dropped Python 3.6 support ([#458][#458])

[#458]: https://github.com/encode/databases/pull/458

### Added

* Add _mapping property to the result set interface (#447 )
* Add contributing docs (#453 )
* Add \_mapping property to the result set interface ([#447][#447])
* Add contributing docs ([#453][#453])

[#447]: https://github.com/encode/databases/pull/447
[#453]: https://github.com/encode/databases/pull/453

### Fixed

* Fix query result named access (#448)
* Fix connections getting into a bad state when a task is cancelled (#457)
* Revert #328 parallel transactions (#472)
* Change extra installations to specific drivers (#436)
* Fix query result named access ([#448][#448])
* Fix connections getting into a bad state when a task is cancelled ([#457][#457])
* Revert #328 parallel transactions ([#472][#472])
* Change extra installations to specific drivers ([#436][#436])

[#448]: https://github.com/encode/databases/pull/448
[#457]: https://github.com/encode/databases/pull/457
[#472]: https://github.com/encode/databases/pull/472
[#436]: https://github.com/encode/databases/pull/436

## 0.5.4 (January 14th, 2022)

### Added

* Support for Unix domain in connections (#423)
* Added `asyncmy` MySQL driver (#382)
* Support for Unix domain in connections ([#423][#423])
* Added `asyncmy` MySQL driver ([#382][#382])

[#423]: https://github.com/encode/databases/pull/423
[#382]: https://github.com/encode/databases/pull/382

### Fixed

* Fix SQLite fetch queries with multiple parameters (#435)
* Changed `Record` type to `Sequence` (#408)
* Fix SQLite fetch queries with multiple parameters ([#435][#435])
* Changed `Record` type to `Sequence` ([#408][#408])

[#435]: https://github.com/encode/databases/pull/435
[#408]: https://github.com/encode/databases/pull/408

## 0.5.3 (October 10th, 2021)

### Added

* Support `dialect+driver` for default database drivers like `postgresql+asyncpg` (#396)
* Support `dialect+driver` for default database drivers like `postgresql+asyncpg` ([#396][#396])

[#396]: https://github.com/encode/databases/pull/396

### Fixed

* Documentation of low-level transaction (#390)
* Documentation of low-level transaction ([#390][#390])

[#390]: https://github.com/encode/databases/pull/390

## 0.5.2 (September 10th, 2021)

### Fixed

* Reset counter for failed connections (#385)
* Avoid dangling task-local connections after Database.disconnect() (#211)
* Reset counter for failed connections ([#385][#385])
* Avoid dangling task-local connections after Database.disconnect() ([#211][#211])

[#385]: https://github.com/encode/databases/pull/385
[#211]: https://github.com/encode/databases/pull/211

## 0.5.1 (September 2nd, 2021)

### Added

* Make database `connect` and `disconnect` calls idempotent (#379)
* Make database `connect` and `disconnect` calls idempotent ([#379][#379])

[#379]: https://github.com/encode/databases/pull/379

### Fixed

* Fix `in_` and `notin_` queries in SQLAlchemy 1.4 (#378)
* Fix `in_` and `notin_` queries in SQLAlchemy 1.4 ([#378][#378])

[#378]: https://github.com/encode/databases/pull/378

## 0.5.0 (August 26th, 2021)

### Added
* Support SQLAlchemy 1.4 (#299)

* Support SQLAlchemy 1.4 ([#299][#299])

[#299]: https://github.com/encode/databases/pull/299

### Fixed

* Fix concurrent transactions (#328)
* Fix concurrent transactions ([#328][#328])

[#328]: https://github.com/encode/databases/pull/328

## 0.4.3 (March 26th, 2021)

### Fixed

* Pin SQLAlchemy to <1.4 (#314)
* Pin SQLAlchemy to <1.4 ([#314][#314])

[#314]: https://github.com/encode/databases/pull/314

## 0.4.2 (March 14th, 2021)

### Fixed

* Fix memory leak with asyncpg for SQLAlchemy generic functions (#273)
* Fix memory leak with asyncpg for SQLAlchemy generic functions ([#273][#273])

[#273]: https://github.com/encode/databases/pull/273

## 0.4.1 (November 16th, 2020)

### Fixed

* Remove package dependency on the synchronous DB drivers (#256)
* Remove package dependency on the synchronous DB drivers ([#256][#256])

[#256]: https://github.com/encode/databases/pull/256

## 0.4.0 (October 20th, 2020)

### Added

* Use backend native fetch_val() implementation when available (#132)
* Replace psycopg2-binary with psycopg2 (#204)
* Speed up PostgresConnection fetch() and iterate() (#193)
* Access asyncpg Record field by key on raw query (#207)
* Allow setting min_size and max_size in postgres DSN (#210)
* Add option pool_recycle in postgres DSN (#233)
* Allow extra transaction options (#242)
* Use backend native fetch_val() implementation when available ([#132][#132])
* Replace psycopg2-binary with psycopg2 ([#204][#204])
* Speed up PostgresConnection fetch() and iterate() ([#193][#193])
* Access asyncpg Record field by key on raw query ([#207][#207])
* Allow setting min_size and max_size in postgres DSN ([#210][#210])
* Add option pool_recycle in postgres DSN ([#233][#233])
* Allow extra transaction options ([#242][#242])

[#132]: https://github.com/encode/databases/pull/132
[#204]: https://github.com/encode/databases/pull/204
[#193]: https://github.com/encode/databases/pull/193
[#207]: https://github.com/encode/databases/pull/207
[#210]: https://github.com/encode/databases/pull/210
[#233]: https://github.com/encode/databases/pull/233
[#242]: https://github.com/encode/databases/pull/242

### Fixed

* Fix type hinting for sqlite backend (#227)
* Fix SQLAlchemy DDL statements (#226)
* Make fetch_val call fetch_one for type conversion (#246)
* Unquote username and password in DatabaseURL (#248)
* Fix type hinting for sqlite backend ([#227][#227])
* Fix SQLAlchemy DDL statements ([#226][#226])
* Make fetch_val call fetch_one for type conversion ([#246][#246])
* Unquote username and password in DatabaseURL ([#248][#248])

[#227]: https://github.com/encode/databases/pull/227
[#226]: https://github.com/encode/databases/pull/226
[#246]: https://github.com/encode/databases/pull/246
[#248]: https://github.com/encode/databases/pull/248
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ Databases is suitable for integrating against any async Web framework, such as [

**Documentation**: [https://www.encode.io/databases/](https://www.encode.io/databases/)

**Requirements**: Python 3.7+
**Requirements**: Python 3.8+

---

@@ -85,7 +85,7 @@ values = [
]
await database.execute_many(query=query, values=values)

# Run a database query.
# Run a database query.
query = "SELECT * FROM HighScores"
rows = await database.fetch_all(query=query)
print('High Scores:', rows)
2 changes: 1 addition & 1 deletion databases/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from databases.core import Database, DatabaseURL

__version__ = "0.7.0"
__version__ = "0.9.0"
__all__ = ["Database", "DatabaseURL"]
Loading