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: encode/databases
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: athenianco/morcilla
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.

Commits on Dec 1, 2021

  1. Copy the full SHA
    dcc42ae View commit details
  2. Merge pull request #1 from athenianco/edit-readme

    [DEV-3174] Update the README for morcilla
    vmarkovtsev authored Dec 1, 2021
    Copy the full SHA
    6662950 View commit details
  3. Copy the full SHA
    f27dad8 View commit details
  4. Merge pull request #2 from athenianco/port-from-athenian-api

    [DEV-3174] Apply the changes from athenianco/athenian-api
    vmarkovtsev authored Dec 1, 2021
    Copy the full SHA
    6a9cf28 View commit details
  5. Copy the full SHA
    e2bece2 View commit details
  6. Copy the full SHA
    7c39c96 View commit details
  7. Merge pull request #3 from athenianco/fix-publish

    [DEV-3174] Fix package publish
    vmarkovtsev authored Dec 1, 2021
    Copy the full SHA
    35bd26d View commit details
  8. Copy the full SHA
    33eeb08 View commit details

Commits on Dec 2, 2021

  1. Copy the full SHA
    e4cd5da View commit details
  2. Merge pull request #4 from athenianco/fix-asyncpg

    [DEV-3174] Do not crash on empty inserted values in asyncpg
    vmarkovtsev authored Dec 2, 2021
    Copy the full SHA
    0596a4e View commit details
  3. Copy the full SHA
    eda0c0e View commit details
  4. Copy the full SHA
    d52d68e View commit details
  5. Merge pull request #5 from athenianco/fix-sqlite

    [DEV-3174] Fix bind param order in sqlite
    vmarkovtsev authored Dec 2, 2021
    Copy the full SHA
    a6260cb View commit details
  6. Copy the full SHA
    df2c368 View commit details
  7. Copy the full SHA
    77de9c4 View commit details
  8. Merge pull request #6 from athenianco/in-memory-sqlite

    [DEV-3174] Correctly handle in-memory SQLite
    vmarkovtsev authored Dec 2, 2021
    Copy the full SHA
    984d4b1 View commit details
  9. Copy the full SHA
    a1c443f View commit details
  10. Copy the full SHA
    3503341 View commit details
  11. Merge pull request #7 from athenianco/support-sqla-1.3

    [DEV-3174] Support SQLAlchemy 1.3
    vmarkovtsev authored Dec 2, 2021
    Copy the full SHA
    a1b88c5 View commit details
  12. Copy the full SHA
    17c42dc View commit details
  13. Copy the full SHA
    130ba12 View commit details
  14. Merge pull request #8 from athenianco/execute_many-no-values

    [DEV-3174] Fix execute_many with no values
    vmarkovtsev authored Dec 2, 2021
    Copy the full SHA
    85bb4cc View commit details
  15. Copy the full SHA
    41b3717 View commit details
  16. Copy the full SHA
    bca3530 View commit details
  17. Merge pull request #9 from athenianco/render_postcompile-1.3

    [DEV-3174] Drop render_postcompile on sqla 1.3
    vmarkovtsev authored Dec 2, 2021
    Copy the full SHA
    9137ea4 View commit details
  18. Copy the full SHA
    22186e9 View commit details

Commits on Dec 3, 2021

  1. Copy the full SHA
    aca488a View commit details
  2. Merge pull request #10 from athenianco/render_postcompile-1.3-sqlite

    [DEV-3174] Disable render_postcompile on sqla 1.3 with sqlite
    vmarkovtsev authored Dec 3, 2021
    Copy the full SHA
    f0c9ffb View commit details
  3. Copy the full SHA
    d326e0f View commit details
  4. Copy the full SHA
    c16097b View commit details
  5. Merge pull request #11 from athenianco/serialize-sqlite-transactions

    [DEV-3174] Serialize SQLite transactions
    vmarkovtsev authored Dec 3, 2021
    Copy the full SHA
    647dfb2 View commit details
  6. Copy the full SHA
    77c339a View commit details
  7. Copy the full SHA
    271c478 View commit details
  8. Merge pull request #12 from athenianco/no-database-is-locked

    [DEV-3306] Ensure "database is locked" does not appear in SQLite
    vmarkovtsev authored Dec 3, 2021
    Copy the full SHA
    2a054f3 View commit details
  9. Copy the full SHA
    9fad54b View commit details
  10. Copy the full SHA
    5e56f02 View commit details
  11. Merge pull request #13 from athenianco/fix-upstream-mention

    [DEV-3306] Fix the left upstream mention
    vmarkovtsev authored Dec 3, 2021
    Copy the full SHA
    02254d5 View commit details
  12. Copy the full SHA
    4368623 View commit details

Commits on Dec 23, 2021

  1. Copy the full SHA
    0376445 View commit details
  2. Merge pull request #14 from athenianco/fix-pg-compile-perf-sqla1.4

    [DEV-3418] Fix Postgres compilation performance drop in sqla 1.4
    vmarkovtsev authored Dec 23, 2021
    Copy the full SHA
    f0f4dce View commit details
  3. Copy the full SHA
    def56e6 View commit details

Commits on Jan 21, 2022

  1. Copy the full SHA
    a9f9754 View commit details
  2. Merge pull request #15 from athenianco/sqlite-regexp

    [DEV-3346] Register REGEXP sqlite function
    vmarkovtsev authored Jan 21, 2022
    Copy the full SHA
    93c1766 View commit details
  3. Copy the full SHA
    7ed0200 View commit details

Commits on Apr 29, 2022

  1. Copy the full SHA
    c605998 View commit details
  2. Merge pull request #16 from athenianco/command-timeout

    [DEV-4110] Add the default command execution timeout
    vmarkovtsev authored Apr 29, 2022
    Copy the full SHA
    a7329d5 View commit details
  3. Copy the full SHA
    be704d0 View commit details

Commits on May 2, 2022

  1. Copy the full SHA
    bccdb6a View commit details
  2. Merge pull request #17 from athenianco/acquire-timeout

    [DEV-4131] Enforce the timeout in PostgresConnection.acquire()
    vmarkovtsev authored May 2, 2022
    Copy the full SHA
    af87db6 View commit details
  3. Copy the full SHA
    7a0be0d View commit details
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ jobs:

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- uses: "actions/setup-python@v2"
with:
python-version: 3.7
python-version: 3.11
- name: "Install dependencies"
run: "scripts/install"
- name: "Build package & docs"
@@ -24,4 +24,4 @@ jobs:
run: "scripts/publish"
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
47 changes: 27 additions & 20 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
@@ -10,24 +10,14 @@ on:
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
if: "!contains(github.event.head_commit.message, 'Bump version') || github.event_name != 'push'"
runs-on: ubuntu-22.04

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

services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: testsuite
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

postgres:
image: postgres:14
env:
@@ -53,11 +43,28 @@ jobs:
env:
TEST_DATABASE_URLS: |
sqlite:///testsuite,
sqlite+aiosqlite:///testsuite,
mysql://username:password@localhost:3306/testsuite,
mysql+aiomysql://username:password@localhost:3306/testsuite,
mysql+asyncmy://username:password@localhost:3306/testsuite,
postgresql://username:password@localhost:5432/testsuite,
postgresql+aiopg://username:password@127.0.0.1:5432/testsuite,
postgresql+asyncpg://username:password@localhost:5432/testsuite
postgresql://username:password@localhost:5432/testsuite
run: "scripts/test"
bump_version:
name: Bump the version
needs: [ tests ]
if: "!contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && github.event_name == 'push'"
runs-on: ubuntu-22.04
steps:
- name: actions/checkout
uses: actions/checkout@v2
with:
fetch-depth: 100
persist-credentials: false
submodules: true
- name: current_version
run: echo "current_version=$(grep '__version__' morcilla/__init__.py | cut -d\" -f2)" >> $GITHUB_ENV
- name: FragileTech/bump-version
uses: FragileTech/bump-version@main
with:
current_version: "${{ env.current_version }}"
files: morcilla/__init__.py
commit_name: Groundskeeper Willie
commit_email: bot@athenian.co
login: gkwillie
token: ${{ secrets.GKWILLIE_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,3 +8,4 @@ __pycache__/
*.egg-info/
htmlcov/
venv/
.idea
78 changes: 0 additions & 78 deletions CHANGELOG.md

This file was deleted.

73 changes: 33 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@
# Databases
# Morcilla

<p>
<a href="https://github.com/encode/databases/actions">
<img src="https://github.com/encode/databases/workflows/Test%20Suite/badge.svg" alt="Test Suite">
<a href="https://github.com/athenianco/morcilla/actions">
<img src="https://github.com/athenianco/morcilla/workflows/Test%20Suite/badge.svg" alt="Test Suite">
</a>
<a href="https://pypi.org/project/databases/">
<img src="https://badge.fury.io/py/databases.svg" alt="Package version">
<a href="https://pypi.org/project/morcilla/">
<img src="https://badge.fury.io/py/morcilla.svg" alt="Package version">
</a>
</p>

Databases gives you simple asyncio support for a range of databases.
Morcilla gives you simple and high-performant asyncio support for a range of databases.
The project is a hard fork of [encode/databases](https://github.com/encode/databases).

It allows you to make queries using the powerful [SQLAlchemy Core][sqlalchemy-core]
expression language, and provides support for PostgreSQL, MySQL, and SQLite.
expression language, and provides support for PostgreSQL and SQLite.

Databases is suitable for integrating against any async Web framework, such as [Starlette][starlette],
[Sanic][sanic], [Responder][responder], [Quart][quart], [aiohttp][aiohttp], [Tornado][tornado], or [FastAPI][fastapi].
Morcilla is suitable for integrating against any async Web framework.

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

**Requirements**: Python 3.6+
**Requirements**: Python 3.8+

---

## Installation

```shell
$ pip install databases
$ pip install morcilla
```

You can install the required database drivers with:

```shell
$ pip install databases[postgresql]
$ pip install databases[mysql]
$ pip install databases[sqlite]
$ pip install morcilla[postgresql]
$ pip install morcilla[sqlite]
```

Default driver support is provided using one of [asyncpg][asyncpg], [aiomysql][aiomysql], or [aiosqlite][aiosqlite].

You can also use other database drivers supported by `databases`:
Default driver support is provided using one of [asyncpg][asyncpg] or [aiosqlite][aiosqlite].

```shel
$ pip install databases[postgresql+aiopg]
$ pip install databases[mysql+asyncmy]
```

Note that if you are using any synchronous SQLAlchemy functions such as `engine.create_all()` or [alembic][alembic] migrations then you still have to install a synchronous DB driver: [psycopg2][psycopg2] for PostgreSQL and [pymysql][pymysql] for MySQL.
Note that if you are using any synchronous SQLAlchemy functions such as `engine.create_all()` or [alembic][alembic] migrations then you still have to install a synchronous DB driver: [psycopg2][psycopg2] for PostgreSQL.

---

@@ -56,7 +47,7 @@ For this example we'll create a very simple SQLite database to run some
queries against.

```shell
$ pip install databases[sqlite]
$ pip install morcilla[sqlite]
$ pip install ipython
```

@@ -67,7 +58,7 @@ expressions directly from the console.

```python
# Create a database instance, and connect to it.
from databases import Database
from morcilla import Database
database = Database('sqlite:///example.db')
await database.connect()

@@ -90,26 +81,28 @@ rows = await database.fetch_all(query=query)
print('High Scores:', rows)
```

Check out the documentation on [making database queries](https://www.encode.io/databases/database_queries/)
for examples of how to start using databases together with SQLAlchemy core expressions.
Check out the documentation on [making database queries](https://www.encode.io/morcilla/database_queries/)
for examples of how to start using morcilla together with SQLAlchemy core expressions.

## Why hard fork?

Morcilla satisfies one particular requirement that Athenian has: to provide the best performance
at any cost, while sacrificing as little developer experience as possible. Hence it rejects
the uniform Record interface that `encode/databases` provides in favor of native backend objects.
Thus there is no guarantee that the same code will work equally successful for all the supported
DB backends. Besides, we have optimized Morcilla for asyncpg, so e.g. asyncpg performs JSON serialization and
deserialization instead of sqlalchemy for performance boost. The character of the changes is
very much breaking the existing code, and they should not be submitted upstream.

<p align="center">&mdash; ⭐️ &mdash;</p>
<p align="center"><i>Databases is <a href="https://github.com/encode/databases/blob/master/LICENSE.md">BSD licensed</a> code. Designed & built in Brighton, England.</i></p>
Finally, we are going to add new backends such as Clickhouse in the future.

## Why "morcilla"?

Morcilla means blood sausage in Spanish. So the name reflects the ~bloody mess~ gory nature of the code.

[sqlalchemy-core]: https://docs.sqlalchemy.org/en/latest/core/
[sqlalchemy-core-tutorial]: https://docs.sqlalchemy.org/en/latest/core/tutorial.html
[alembic]: https://alembic.sqlalchemy.org/en/latest/
[psycopg2]: https://www.psycopg.org/
[pymysql]: https://github.com/PyMySQL/PyMySQL
[asyncpg]: https://github.com/MagicStack/asyncpg
[aiomysql]: https://github.com/aio-libs/aiomysql
[aiosqlite]: https://github.com/jreese/aiosqlite

[starlette]: https://github.com/encode/starlette
[sanic]: https://github.com/huge-success/sanic
[responder]: https://github.com/kennethreitz/responder
[quart]: https://gitlab.com/pgjones/quart
[aiohttp]: https://github.com/aio-libs/aiohttp
[tornado]: https://github.com/tornadoweb/tornado
[fastapi]: https://github.com/tiangolo/fastapi
4 changes: 0 additions & 4 deletions databases/__init__.py

This file was deleted.

Loading