Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add piccolo db #104

Merged
merged 8 commits into from
Mar 6, 2024
Merged

Add piccolo db #104

merged 8 commits into from
Mar 6, 2024

Conversation

sayanarijit
Copy link
Member

Also use FastAPI dependency for async db transaction.

Also use FastAPI dependency for async db transaction.
Comment on lines 27 to 36
def dbtransaction(engine: Optional[PostgresEngine] = None, allow_nested=True):
def wrapper(f):
@wraps(f)
async def f_wrapped(*args, **kw):
async with dbtransaction_ctx(engine, allow_nested=allow_nested):
return await f(*args, **kw)

return f_wrapped

return wrapper
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't be using it in FastAPI. This is only for hug compatibility (and apphelpers tests).

result = f(*args, **kw)
return result
with dbtransaction_ctx(db):
return f(*args, **kw)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't be using it in FastAPI. This is only for hug compatibility (and apphelpers tests).

@sayanarijit sayanarijit merged commit 62dc40b into master Mar 6, 2024
1 check passed
@sayanarijit sayanarijit deleted the add-piccolo branch March 6, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants