Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
qwery is a small and lightweight query builder based on asyncpg and pydantic.
In my opinion query builders strike a great balance between the flexibility of raw SQL, the structure and safety of pre-crafted queries, and the comfortable data layer of an ORM.
These benefits come with some downsides:
qwery works best with a model + queries + helper pattern, namely:
from pydantic import BaseModel
from qwery import Query
class MyModel(BaseModel):
class Meta:
table_name = "my_table"
id: int
name: str
desc: Optional[str]
active: bool
class MyModelQueries:
create = Query(MyModel).insert(body=True).execute()
delete_by_id = Query(MyModel).delete().where("id = {.id}").execute()
get_by_id = Query(MyModel).select().where("id = {.id}").fetch_one()
get_all = Query(MyModel).select().fetch_all()
async with pool.acquire() as conn:
model = MyModel(id=1, name="test", desc=None, active=True)
await MyModelQueries.create(conn, model=model)
model = await MyModelQueries.get_by_id(conn, id=1)
models = await MyModelQueries.get_all(conn)
assert models == [model]
await MyModelQueries.delete(conn, id=1)
FAQs
small and lightweight query builder and data layer based on Pydantic and asyncpg
We found that qwery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.