Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Quart extension that provides managed connection(s) to postgresql database(s).

License

NotificationsYou must be signed in to change notification settings

pgjones/quart-db

Repository files navigation

Build Statusdocspypipythonlicense

Quart-DB is a Quart extension that provides managed connection(s) topostgresql or sqlite database(s).

Quickstart

Quart-DB is used by associating it with an app and a DB (via a URL)and then utilising theg.connection connection,

fromquartimportg,Quart,websocketfromquart_dbimportQuartDBapp=Quart(__name__)db=QuartDB(app,url="postgresql://user:pass@localhost:5432/db_name")@app.get("/<int:id>")asyncdefget_count(id:int):result=awaitg.connection.fetch_val("SELECT COUNT(*) FROM tbl WHERE id = :id",        {"id":id},    )return {"count":result}@app.post("/")asyncdefset_with_transaction():asyncwithg.connection.transaction():awaitdb.execute("UPDATE tbl SET done = :done", {"done":True})        ...return {}@app.get("/explicit")asyncdefexplicit_usage():asyncwithdb.connection()asconnection:         ...

Contributing

Quart-DB is developed onGitHub. If you come across an issue,or have a feature request please open anissue. If you want tocontribute a fix or the feature-implementation please do (typo fixeswelcome), by proposing amerge request.

Testing

The best way to test Quart-DB is withTox,

$pip install tox$tox

this will check the code style and run the tests.

Help

The Quart-DBdocumentation is the best places tostart, after that try searchingstack overflow or ask for helpon gitter. If you stillcan't find an answer pleaseopen an issue.

About

Quart extension that provides managed connection(s) to postgresql database(s).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp