Skip to content

Commit 4c8bfbe

Browse files
committed
adding configuration examples
1 parent b06d1b1 commit 4c8bfbe

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/recipes/asyncDatabase.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,56 @@ if __name__ == "__main__":
227227

228228
uvicorn.run(app, host="127.0.0.1", port=5000)
229229
```
230+
231+
232+
### Configuration Examples
233+
234+
```python
235+
# SQLite in memory database
236+
config = {
237+
"database_uri": "sqlite+aiosqlite:///:memory:?cache=shared",
238+
"echo": False,
239+
"future": True,
240+
"pool_recycle": 3600,
241+
}
242+
```
243+
244+
```python
245+
# PostgreSQL database
246+
config = {
247+
"database_uri": "postgresql+asyncpg://postgres:postgres@postgresdb/postgres",
248+
"echo": False,
249+
"future": True,
250+
"pool_recycle": 3600,
251+
}
252+
```
253+
254+
```python
255+
# MySQL database
256+
config = {
257+
"database_uri": "mysql+aiomysql://root:root@localhost/test",
258+
"echo": False,
259+
"future": True,
260+
"pool_recycle": 3600,
261+
}
262+
```
263+
264+
```python
265+
# SQL Server database
266+
config = {
267+
"database_uri": "mssql+aiomssql://sa:yourStrong(!)Password@localhost:1433/master",
268+
"echo": False,
269+
"future": True,
270+
"pool_recycle": 3600,
271+
}
272+
```
273+
274+
```python
275+
# Oracle database
276+
config = {
277+
"database_uri": "oracle+oracledb_async://scott:tiger@localhost/?service_name=XEPDB1",
278+
"echo": False,
279+
"future": True,
280+
"pool_recycle": 3600,
281+
}
282+
```

0 commit comments

Comments
 (0)