
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Wrapper around SQLAlchemy async session, core and Postgres native features
Version: 0.6.10
Documentation: https://asynq-io.github.io/sqlargon/
Repository: https://github.com/asynq-io/sqlargon
This library provides glue code to use sqlalchemy async sessions, core queries and orm models from one object which provides somewhat of repository pattern. This solution has few advantages:
session
object to every function/method. It is stored (and optionally injected) in repository objectinsert
,update
, delete
, select
from sqlalchemy over and over again.scalars().all()
or .one()
import sqlalchemy as sa
from sqlalchemy.orm import Mapped
from sqlargon import GUID, GenerateUUID, Database, Base, SQLAlchemyRepository
db = Database(url=...)
class User(Base):
id = sa.Column(
GUID(), primary_key=True, server_default=GenerateUUID(), nullable=False
)
name: Mapped[str] = sa.Column(sa.Unicode(255))
class UserRepository(SQLAlchemyRepository[User]):
async def get_user_by_name(self, name: str):
# custom user function
return await self.select().filter_by(name=name).one()
user_repository = UserRepository(db)
# select
await user_repository.all()
await user_repository.list(User.name == "test", User.id >= 18)
# insert
user = await user_repository.insert({"name": "test"}).one()
await user_repository.commit()
# delete
await user_repository.delete().filter(name="John").one()
# custom sqlalchemy core functions
users = await user_repository.select().join(...).filter(
User.name == "test"
).filter_by(...).order_by(User.created_at).limit(2).all()
Manager object needs sqlalchemy.ext.asyncio.AsyncSession
, but it's possible
to provide the session object by yourself, by subclassing Manager class e.g.
from sqlargon import Database, SQLAlchemyRepository
from fastapi import Depends
db = Database(url="sqlite+aiosqlite:///:memory:")
class UserRepository(SQLAlchemyRepository[User]):
...
from fastapi import FastAPI
app = FastAPI()
@app.get("/users")
async def get_users(user_repository: UserRepository = db.Depends(UserRepository)):
return await user_repository.all()
FAQs
SQLAlchemy utils for Postgres and Sqlite
We found that sqlargon demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.