Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit c2417cd

Browse files
aminalaeecollerek
andauthored
Switch extra installations to specific drivers (#436)
Co-authored-by: collerek <[email protected]>
1 parent f6b28ad commit c2417cd

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,22 @@ Databases is suitable for integrating against any async Web framework, such as [
2929
$ pip install databases
3030
```
3131

32-
You can install the required database drivers with:
33-
34-
```shell
35-
$ pip install databases[postgresql]
36-
$ pip install databases[mysql]
37-
$ pip install databases[sqlite]
38-
```
32+
Database drivers supported are:
3933

40-
Default driver support is provided using one of [asyncpg][asyncpg], [aiomysql][aiomysql], or [aiosqlite][aiosqlite].
34+
* [asyncpg][asyncpg]
35+
* [aiopg][aiopg]
36+
* [aiomysql][aiomysql]
37+
* [asyncmy][asyncmy]
38+
* [aiosqlite][aiosqlite]
4139

42-
You can also use other database drivers supported by `databases`:
40+
You can install the required database drivers with:
4341

44-
```shel
45-
$ pip install databases[postgresql+aiopg]
46-
$ pip install databases[mysql+asyncmy]
42+
```shell
43+
$ pip install databases[asyncpg]
44+
$ pip install databases[aiopg]
45+
$ pip install databases[aiomysql]
46+
$ pip install databases[asyncmy]
47+
$ pip install databases[aiosqlite]
4748
```
4849

4950
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.
@@ -56,7 +57,7 @@ For this example we'll create a very simple SQLite database to run some
5657
queries against.
5758

5859
```shell
59-
$ pip install databases[sqlite]
60+
$ pip install databases[aiosqlite]
6061
$ pip install ipython
6162
```
6263

@@ -68,7 +69,7 @@ expressions directly from the console.
6869
```python
6970
# Create a database instance, and connect to it.
7071
from databases import Database
71-
database = Database('sqlite:///example.db')
72+
database = Database('sqlite+aiosqlite:///example.db')
7273
await database.connect()
7374

7475
# Create a table.
@@ -103,8 +104,10 @@ for examples of how to start using databases together with SQLAlchemy core expre
103104
[psycopg2]: https://www.psycopg.org/
104105
[pymysql]: https://github.com/PyMySQL/PyMySQL
105106
[asyncpg]: https://github.com/MagicStack/asyncpg
107+
[aiopg]: https://github.com/aio-libs/aiopg
106108
[aiomysql]: https://github.com/aio-libs/aiomysql
107-
[aiosqlite]: https://github.com/jreese/aiosqlite
109+
[asyncmy]: https://github.com/long2ice/asyncmy
110+
[aiosqlite]: https://github.com/omnilib/aiosqlite
108111

109112
[starlette]: https://github.com/encode/starlette
110113
[sanic]: https://github.com/huge-success/sanic

docs/connections_and_transactions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ and for configuring the connection pool.
4444

4545
```python
4646
# Use an SSL connection.
47-
database = Database('postgresql://localhost/example?ssl=true')
47+
database = Database('postgresql+asyncpg://localhost/example?ssl=true')
4848

4949
# Use a connection pool of between 5-20 connections.
50-
database = Database('mysql://localhost/example?min_size=5&max_size=20')
50+
database = Database('mysql+aiomysql://localhost/example?min_size=5&max_size=20')
5151
```
5252

5353
You can also use keyword arguments to pass in any connection options.
5454
Available keyword arguments may differ between database backends.
5555

5656
```python
57-
database = Database('postgresql://localhost/example', ssl=True, min_size=5, max_size=20)
57+
database = Database('postgresql+asyncpg://localhost/example', ssl=True, min_size=5, max_size=20)
5858
```
5959

6060
## Transactions

docs/database_queries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You can now use any [SQLAlchemy core][sqlalchemy-core] queries ([official tutori
3434
```python
3535
from databases import Database
3636

37-
database = Database('postgresql://localhost/example')
37+
database = Database('postgresql+asyncpg://localhost/example')
3838

3939

4040
# Establish the connection pool

docs/index.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,22 @@ Databases is suitable for integrating against any async Web framework, such as [
2727
$ pip install databases
2828
```
2929

30-
You can install the required database drivers with:
31-
32-
```shell
33-
$ pip install databases[postgresql]
34-
$ pip install databases[mysql]
35-
$ pip install databases[sqlite]
36-
```
30+
Database drivers supported are:
3731

38-
Default driver support is provided using one of [asyncpg][asyncpg], [aiomysql][aiomysql], or [aiosqlite][aiosqlite].
32+
* [asyncpg][asyncpg]
33+
* [aiopg][aiopg]
34+
* [aiomysql][aiomysql]
35+
* [asyncmy][asyncmy]
36+
* [aiosqlite][aiosqlite]
3937

40-
You can also use other database drivers supported by `databases`:
38+
You can install the required database drivers with:
4139

42-
```shel
43-
$ pip install databases[postgresql+aiopg]
44-
$ pip install databases[mysql+asyncmy]
40+
```shell
41+
$ pip install databases[asyncpg]
42+
$ pip install databases[aiopg]
43+
$ pip install databases[aiomysql]
44+
$ pip install databases[asyncmy]
45+
$ pip install databases[aiosqlite]
4546
```
4647

4748
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.
@@ -54,7 +55,7 @@ For this example we'll create a very simple SQLite database to run some
5455
queries against.
5556

5657
```shell
57-
$ pip install databases[sqlite]
58+
$ pip install databases[aiosqlite]
5859
$ pip install ipython
5960
```
6061

@@ -66,7 +67,7 @@ expressions directly from the console.
6667
```python
6768
# Create a database instance, and connect to it.
6869
from databases import Database
69-
database = Database('sqlite:///example.db')
70+
database = Database('sqlite+aiosqlite:///example.db')
7071
await database.connect()
7172

7273
# Create a table.
@@ -101,8 +102,10 @@ for examples of how to start using databases together with SQLAlchemy core expre
101102
[psycopg2]: https://www.psycopg.org/
102103
[pymysql]: https://github.com/PyMySQL/PyMySQL
103104
[asyncpg]: https://github.com/MagicStack/asyncpg
105+
[aiopg]: https://github.com/aio-libs/aiopg
104106
[aiomysql]: https://github.com/aio-libs/aiomysql
105-
[aiosqlite]: https://github.com/jreese/aiosqlite
107+
[asyncmy]: https://github.com/long2ice/asyncmy
108+
[aiosqlite]: https://github.com/omnilib/aiosqlite
106109

107110
[starlette]: https://github.com/encode/starlette
108111
[sanic]: https://github.com/huge-success/sanic

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ def get_packages(package):
5050
install_requires=["sqlalchemy>=1.4,<1.5", 'aiocontextvars;python_version<"3.7"'],
5151
extras_require={
5252
"postgresql": ["asyncpg"],
53+
"asyncpg": ["asyncpg"],
54+
"aiopg": ["aiopg"],
5355
"mysql": ["aiomysql"],
54-
"mysql+asyncmy": ["asyncmy"],
56+
"aiomysql": ["aiomysql"],
57+
"asyncmy": ["asyncmy"],
5558
"sqlite": ["aiosqlite"],
56-
"postgresql+aiopg": ["aiopg"],
59+
"aiosqlite": ["aiosqlite"],
5760
},
5861
classifiers=[
5962
"Development Status :: 3 - Alpha",

0 commit comments

Comments
 (0)