WeSearch

I built a 57-line asyncpg wrapper because SQLAlchemy was driving me insane

·3 min read · 0 reactions · 0 comments · 4 views
#python#sqlalchemy#asyncpg#database#orm
I built a 57-line asyncpg wrapper because SQLAlchemy was driving me insane
⚡ TL;DR · AI summary

The developer, frustrated with SQLAlchemy's complexity in Python, created a minimal asyncpg wrapper called EzQL that allows writing raw SQL while getting typed Pydantic models back. EzQL avoids ORM abstractions, focusing on simplicity, transparency, and type safety with explicit queries. It includes a CLI tool to validate models against the database schema before deployment.

Key facts
Original article
DEV.to (Top)
Read full at DEV.to (Top) →
Opening excerpt (first ~120 words) tap to expand

try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3908416) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } kernz Posted on May 2 I built a 57-line asyncpg wrapper because SQLAlchemy was driving me insane #sql #python #sqlalchemy #postgres I came from Rust where I used sqlx — you write raw SQL, you get typed structs back. Simple, honest, fast. Then I had to write Python and reached for SQLAlchemy. Big mistake. Suddenly I was learning a DSL on top of SQL. Debugging what ORM decided to generate behind my back. Fighting N+1 queries I didn't even know were happening.

Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from DEV.to (Top)