Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Utilitarian Python ORM for Postgres/SQLite, backed by asyncpg/aiosqlite, Pydantic, and PyPika
Readme
Utilitarian Python ORM for Postgres/SQLite powered by asyncpg/aiosqlite, Pydantic, and PyPika
Documentation: https://rafalstapinski.github.io/p3orm
Source Code: https://github.com/rafalstapinski/p3orm
90% of the time we talk to a database is with a CRUD operation. p3orm provides convenience helpers for fetching (one, first, many), inserting (one, many), updating (one), and deleting (one, many).
The remaining 10% is a bit more complicated. p3orm doesn't attempt to hide SQL queries or database interactions behind any magic. Instead, it empowers you to write direct and legible SQL queries with PyPika and execute them explicitly against the database.
Notably, objects created or fetched by p3orm are dead, they're just Pydantic models. If you want to interact with the database, you do so explicitly.
Pydantic
PyPika
queriespostgres
datatypessqlite
datatypesInstall with poetry
poetry add p3orm[sqlite]
# or
poetry add p3orm[postgres]
or with pip
pip install p3orm[sqlite]
# or
pip install p3orm[postgres]
The [sqlite]
extra installs aiosqlite
as p3orm's database driver, whereas [postgres]
installs asyncpg
.
from datetime import datetime
from p3orm import Column, Table
from p3orm import sqlite as db
# or: from p3orm import postgres as db
class Thing(Table):
id = Column(int, pk=True, autogen=True)
name = Column(str)
created_at = Column(datetime, autogen=True)
await db().connect(":memory:")
thing = Thing(name="Name")
inserted = await Thing.insert_one(thing)
fetched = await Thing.fetch_first(Thing.id == 1)
fetched.name = "Changed"
updated = await Thing.update_one(fetched)
deleted = await Thing.delete_where(Thing.id == updated.id)
await db().disconnect()
FAQs
Utilitarian Python ORM for Postgres/SQLite, backed by asyncpg/aiosqlite, Pydantic, and PyPika
We found that p3orm 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.