Menu

Post image 1
Post image 2
1 / 2
0

I built a tiny Python library that turns method names into SQL queries

DEV Community: database·Kamyar Inanloo·3 days ago
#15i4asTz
#dev#status#simple#select#users#active
Reading 0:00
15s threshold

I’ve been working on a small library called guess-what. The idea is simple: instead of writing boilerplate CRUD queries or repository methods, you call semantic method names and the library turns them into SQL. For example: db.get_user_by_id(123) SELECT * FROM users WHERE id = ? db.get_user_columns_name_and_email_by_status(status="active") SELECT name,email FROM users WHERE status = ? db.add_user(user={"name": "Alice", "email": " alice@example.com ", "status": "active"}) INSERT INTO users (name,email,status) VALUES (?, ?, ?) It supports: sync and async database connections keyword arguments dataclasses Pydantic models dict-based reads/writes simple dynamic SELECT / INSERT / UPDATE / DELETE stored procedure/function calls with call_... I’m intentionally not trying to build a full ORM like SQLAlchemy, Django ORM, or PonyORM. The goal is more like a tiny convention-based micro-ORM for simple CRUD, prototypes, scripts, admin tools, and small apps.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More