Skip to content

Commit 0c569e8

Browse files
committed
initial
1 parent 98b0bed commit 0c569e8

File tree

3 files changed

+23
-30
lines changed

3 files changed

+23
-30
lines changed

README.rst renamed to README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
FastAPI-Async-SQLAlchemy
2-
==================
1+
# FastAPI Async SQLAlchemy middleware
32

4-
.. image:: https://github.com/h0rn3t/fastapi-async-sqlalchemy/workflows/ci/badge.svg
5-
:target: https://github.com/h0rn3t/fastapi-async-sqlalchemy/actions
6-
.. image:: https://codecov.io/gh/h0rn3t/fastapi-async-sqlalchemy/branch/master/graph/badge.svg
7-
:target: https://codecov.io/gh/h0rn3t/fastapi-async-sqlalchemy
8-
.. image:: https://img.shields.io/pypi/v/fastapi_async_sqlalchemy?color=blue
9-
:target: https://pypi.org/project/fastapi-async-sqlalchemy
3+
[![ci](https://github.com/h0rn3t/fastapi-async-sqlalchemy/workflows/ci/badge.svg)](https://github.com/h0rn3t/fastapi-async-sqlalchemy/workflows/ci/badge.svg)
4+
[![codecov](https://codecov.io/gh/h0rn3t/fastapi-async-sqlalchemy/branch/master/graph/badge.svg)](https://codecov.io/gh/h0rn3t/fastapi-async-sqlalchemy/branch/master/graph/badge.svg)
5+
[![License](https://img.shields.io/npm/l/xxtea-node.svg)](http://opensource.org/licenses/MIT)
6+
[![pip](https://img.shields.io/pypi/v/fastapi_async_sqlalchemy?color=blue)](https://img.shields.io/pypi/v/fastapi_async_sqlalchemy?color=blue)
107

8+
### Description
119

12-
FastAPI-Async-SQLAlchemy provides a simple integration between FastAPI_ and SQLAlchemy_ in async way. It gives access to useful helpers to facilitate the completion of common tasks.
13-
Based on FastAPI-SQLAlchemy
10+
FastAPI-Async-SQLAlchemy provides a simple integration between FastAPI_ and SQLAlchemy_ in async way. It gives access to useful helpers to facilitate the completion of common tasks. Based on FastAPI-SQLAlchemy
1411

15-
Installing
16-
----------
12+
### Install
1713

18-
Install and update using pip_:
14+
```bash
15+
pip install fastapi-async-sqlalchemy
16+
```
1917

20-
.. code-block:: text
18+
### Usage
2119

22-
$ pip install fastapi-async-sqlalchemy
20+
FastAPI-Async-SQLAlchemy provides a simple integration between FastAPI_ and SQLAlchemy_ in async way. It gives access to useful helpers to facilitate the completion of common tasks.
21+
Based on FastAPI-SQLAlchemy
2322

23+
### Examples
2424

25-
Examples
26-
--------
2725

2826
Usage inside of a route
29-
^^^^^^^^^^^^^^^^^^^^^^^
3027

31-
.. code-block:: python
28+
29+
```python
3230

3331
from fastapi import FastAPI
3432
from fastapi_async_sqlalchemy import SQLAlchemyMiddleware # middleware helper
@@ -48,16 +46,15 @@ Usage inside of a route
4846
users = db.session.query(User).all()
4947

5048
return users
49+
```
5150

5251
Note that the session object provided by ``db.session`` is based on the Python3.7+ ``ContextVar``. This means that
5352
each session is linked to the individual request context in which it was created.
5453

55-
Usage outside of a route
56-
^^^^^^^^^^^^^^^^^^^^^^^^
57-
54+
### Usage outside of a route
5855
Sometimes it is useful to be able to access the database outside the context of a request, such as in scheduled tasks which run in the background:
5956

60-
.. code-block:: python
57+
```python
6158

6259
import pytz
6360
from apscheduler.schedulers.asyncio import AsyncIOScheduler # other schedulers are available
@@ -94,8 +91,4 @@ Sometimes it is useful to be able to access the database outside the context of
9491
# no longer able to access a database session once the db() context manager has ended
9592

9693
return users
97-
98-
99-
.. _FastAPI: https://github.com/tiangolo/fastapi
100-
.. _SQLAlchemy: https://github.com/pallets/flask-sqlalchemy
101-
.. _pip: https://pip.pypa.io/en/stable/quickstart/
94+
```

fastapi_async_sqlalchemy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__all__ = ["db", "SQLAlchemyMiddleware"]
44

5-
__version__ = "0.3.0a6"
5+
__version__ = "0.3.0a7"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author_email="[email protected]",
2323
description="SQLAlchemy middleware for FastAPI",
2424
long_description=long_description,
25-
long_description_content_type="text/x-rst",
25+
long_description_content_type="text/markdown",
2626
packages=["fastapi_async_sqlalchemy"],
2727
package_data={"fastapi_async_sqlalchemy": ["py.typed"]},
2828
zip_safe=False,

0 commit comments

Comments
 (0)