Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language integration & better CI/CD safety #3387

Open
antspy opened this issue Feb 16, 2025 · 0 comments
Open

Language integration & better CI/CD safety #3387

antspy opened this issue Feb 16, 2025 · 0 comments

Comments

@antspy
Copy link

antspy commented Feb 16, 2025

Hi,

I have recently started looking into atlas, and it looks pretty cool - it really seems like finally proper DevOps practices are coming to the DB world. This has been long overdue!

I have a feature proposal for you, which I think might be an interesting way to 'close the loop' and allow atlas to become an 'all you need' setup.

Atlas right now concerns itself with the database side of things - write sql, define tables, databases, apply migration, check migrations are safe, etc.

There is not much linking it to actual programming languages. There is a section about integrating ORMs into the setup, but ORMs often require a different level of abstraction (often leaky) and they're not for everyone. They are also relatively heavyweight and not trivial to integrate.

What would be cool is partnering with https://sqlc.dev/ or doing something like they are doing. You already inspect and understand the schema - it should be doable to have an option to emit type definitions in several programming languages. So if you have a Table {user, id} in your database, you can auto-generate tables like

@dataclass.dataclass
class Table:
  user: string | None
  id: string

or something like this - same for typescript, go, and the most common languages. [0]

Not only tables - you could also do the same for queries. SQL queries are saved somewhere to disk, and you can analyse them and spit out functions which call those queries, annotating them with the appropriate input & output types computed from the db schema.

This also allows you to have better CI - as part of the CI step, you can test the sql queries saved to ensure they would work fine with the new schema before applying it - which is something that currently it's not done, right?
You have a more holistic view of the usage of the database, it allows better integration tests, and using the generated types, it allows for seamless integration into many programming languages.

Let me know what you think - this is probably not a trivial effort, but I was just curious to see if this is something that's on your radar at all. At least for me, it would become an amazing DevX, requiring essentially no other tool to fully manage a database.

[0] Alternatively, you can also support a language-independent format like protobuf - which would then be compiled to typescript, python bindings, etc. This would also have the advantage of being able to use the same protobuf object across services talking to the db.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant