3 ms·
This is something that really bugs me about OCaml in general. There's really no good option to do database access that doesn't involve writing raw, non-composab
by snuxoll 11y ago
This is something that really bugs me about OCaml in general. There's really no good option to do database access that doesn't involve writing raw, non-composable SQL queries. I don't need a full blown ORM, but something that makes writing type-safe (and injection-resistant) SQL queries like JOOQ would be absolutely amazing. For now I'm just sticking with Python and SQLAlchemy, as much as I love OCaml and F#.
- insulanian 11y agoF# doesn't fit into the rest of your comment. There are type providers and Entity Framework, both of which are very good options for DB access.
- snuxoll 11y agoIFF you are using Microsoft SQL Server, sure. Any other RDBMS is a crapshoot, I've been using FsSql which works but I have to devolve into manually manipulating SQL Query strings to do anything sufficiently advanced. Technically there is SQLProvider, but it's ugly as sin (I also don't care for type providers in general, I don't need automatic code generation, I have no problem specifying my schema and not needing access to a database server just to compile my code).
- insulanian 11y agoI'm using PostgreSQL with Entity Framework and running my code on Mono. It all works in production on an AWS Ubuntu instance with DB in RDS. Very happy. Edit: Forgot to mention that no Visual Studio or Windows is used in the process.
- snuxoll 11y agoEntity Framework is extremely heavy and not really what I am looking for. I really just want a lightweight layer over SQL that makes query generation safe, not a full blown ORM (think JOOQ, SQLAlchemy).
- daxfohl 11y agoI use Dapper with F# both on Mono/Linux (test/prod) and on Windows (dev/build/test) and it works great and I've never had an OS porting issue in three years. There are extensions that make it more composable, but haven't needed them yet. Type safe solutions, in terms of using code expressions that get translated into SQL, exist too. However everywhere I look people complain about how horribly inefficient and frequently buggy the generated SQL is. This is true in LINQ, EF, Scala's SQL generator, etc. Stackoverflow obviously created Dapper for a reason. So I've thus far avoided these "too clever by half" solutions; Dapper is perfectly fine.
- wastaz 11y agoI actually also thought that this was a problem so I started trying to build an ORM-ish thing in F#. I havent had that much time to spend on it lately, but its in a pretty OK state as is. If you have any comments or opinions then Im open for all suggestions :) https://github.com/wastaz/hyperboliq https://github.com/wastaz/hyperboliq