Skip to main content

One post tagged with "sqlalchemy from database"

View All Tags

Generate OpenAPI, GraphQL, SQLAlchemy, and TypeORM from Your Database Schema

Your PostgreSQL column says subscriber_count_cache. Your OpenAPI spec says subscriber_count. Your GraphQL type says subscriberCount. Your TypeORM entity says subscriberCountCache. Your SQLAlchemy model says subscriber_count.

Which one is right? All five. And that's the problem.

This is schema drift — the slow, silent divergence between your database, your API contract, and your ORM layer that starts the moment these representations are maintained separately. It doesn't happen because engineers are careless. It happens because there's no structural reason they should stay synchronized. Each representation lives in a different file, edited by a different person, on a different cadence. Eighteen months in, you have five artifacts that all claim to describe the same data model and agree on nothing.

The fix isn't more discipline. It isn't a code generator wired into your CI. It's a completely different workflow:

Design your database schema once in TalkingSchema. Then talk to your schema to generate every other representation — OpenAPI, GraphQL, SQLAlchemy, TypeORM — from the same canonical model, on demand.

That's the whole post. The rest of it just shows what that looks like.