Zulip Chat Archive
Stream: general
Topic: Database access in Lean
Fabian Huch (Mar 15 2024 at 16:32):
If I wanted to access a database (e.g., postgres) from within lean, how could I do this? Would I have to implement a postgres driver in lean, or is there a way around that (for instance by re-using c++ libraries)?
Henrik Böving (Mar 15 2024 at 17:18):
Fabian Huch said:
If I wanted to access a database (e.g., postgres) from within lean, how could I do this? Would I have to implement a postgres driver in lean, or is there a way around that (for instance by re-using c++ libraries)?
Both of those are options, Lean has proper C FFI so you can write bindings to a postgres library or use projects like https://github.com/hargoniX/socket.lean to develop the protocol yourself.
Fabian Huch (Mar 15 2024 at 17:21):
Thanks!
Florian Würmseer (Mar 15 2024 at 18:12):
Hi @Fabian Huch , I was working on a toy implementation a while back https://github.com/FWuermse/lean-postgres. So far only insert and query operations are supported and the socket lib is outdated. However I'm planning on bumping the socket library and add missing operations througout my upcoming Semester.
Fabian Huch (Mar 15 2024 at 18:14):
Very cool, that's quite interesting!
Arthur Paulino (Mar 15 2024 at 19:17):
Also https://github.com/arthurpaulino/LeanMySQL
Last updated: May 02 2025 at 03:31 UTC