Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ on:

jobs:
deploy:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.8 ]
poetry-version: [ 1.1.11 ]
os: [ ubuntu-latest ]
steps:
- uses: rymndhng/release-on-push-action@master
env:
Expand Down
22 changes: 21 additions & 1 deletion README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ Python Micro Framework Data는 [Falcon](https://falcon.readthedocs.io/en/stable/



## How to install (rdb)

Python Micro Framework Data 라이브러리를 관계형 데이터베이스용도로 설치하는 경우 아래의 명령어를 입력하십시오.

```shell
$ pip install python-mf-data[rdb]
```

```shell
$ poetry add "python-mf-data[rdb]"
```

extra 옵션에 반드시 rdb를 입력해야 SQLAlchemy 등의 하위 디펜던시가 설치됩니다.



<br />



## Connection Example (rdb)

아래의 코드는 pymfdata에 있는 SQLAlchemy의 커넥션을 생성하는 예제입니다.
Expand Down Expand Up @@ -207,4 +227,4 @@ class MemoUseCase:

작업 단위 패턴 또한 비동기, 동기에 따라 클래스가 별도로 구현되어 있습니다. 생성한 커넥션에 맞춰 사용하시면 됩니다.

이렇게 만들어진 작업 단위 클래스는 애플리케이션의 비즈니스 로직을 정의할 ***UseCase*** 클래스에 담아 사용할 수 있습니다. 사실상 비즈니스 로직에서 트랜잭션이 필요로 하는 경우의 코드이기 때문에 작업 단위 패턴에 있는 메서드에 ```transactional``` 데코레이터를 사용합니다.
이렇게 만들어진 작업 단위 클래스는 애플리케이션의 비즈니스 로직을 정의할 ***UseCase*** 클래스에 담아 사용할 수 있습니다. 사실상 비즈니스 로직에서 트랜잭션이 필요로 하는 경우의 코드이기 때문에 작업 단위 패턴에 있는 메서드에 ```transactional``` 데코레이터를 사용하여 트랜잭션을 처리할 수 있습니다.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ Currently, this library is **still under development**. The only stable database



## How to install (rdb)

If you are installing the Python Micro Framework Data library for a relational database, enter the command below.

```shell
$ pip install python-mf-data[rdb]
```

```shell
$ poetry add "python-mf-data[rdb]"
```

You must enter **rdb** in the extra option to install sub-dependencies such as SQLAlchemy.



<br />



## Connection Example (rdb)

If you want to create a connection in SQLAlchemy using ```pymfdata```, please follow the instructions below.
Expand Down
12 changes: 0 additions & 12 deletions pymfdata/rdb/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@ async def __aenter__(self):
async def __aexit__(self, exc_type: Optional[Type[Exception]], exc_val: Optional[Exception], traceback):
await self.session.close()

def begin(self, **kwargs):
self.session.begin(**kwargs)

async def commit(self):
await self.session.commit()

async def flush(self):
await self.session.flush()

def is_active(self) -> bool:
return self.session.is_active

async def refresh(self, item):
await self.session.refresh(item)

Expand All @@ -47,17 +41,11 @@ def __enter__(self):
def __exit__(self, exc_type: Optional[Type[Exception]], exc_val: Optional[Exception], traceback):
self.session.close()

def begin(self, **kwargs):
self.session.begin(**kwargs)

def commit(self):
self.session.commit()

def flush(self):
self.session.flush()

def is_active(self) -> bool:
return self.session.is_active

def rollback(self):
self.session.rollback()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "python-mf-data"
version = "0.2.1"
version = "0.2.2"
description = "Python Micro Framework Data"
authors = ["Neon K.I.D <contact@neonkid.xyz>"]
packages = [
Expand Down