Hacker News new | ask | show | jobs
by eliasmacpherson 1226 days ago
So say I wanted to try out a workload on various sql databases, mariadb, sqllite, postgres - is there a database that will act as a front end to them?

I find this 'support for pluggable database engines' intriguing. Not least because I can then claim to have used all of the database engines in anger :-)

(I know that it is probably a dumb question due to the following, but I asked anyway: https://en.wikipedia.org/wiki/SQL#Interoperability_and_stand...)

3 comments

It's not a dumb question at all. I'm pretty knowledgeable with DBs and still find it very difficult to understand how many of these front-end/pass-through engines work.

Checkout Postgres Foreign Data Wrappers. That might be the most well known approach for accessing one database through another. The Supabase team wrote an interesting piece about this recently.

https://supabase.com/blog/postgres-foreign-data-wrappers-rus...

You might also want to try out duckdb's approach to reading other DBs (or DB files). They talk about how they can "import" a sqlite DB in the above 0.7.0 announcement, but also have some other examples in their duckdblabs github project. Check out their "...-scanner" repos:

https://github.com/duckdblabs/postgres_scanner

https://github.com/duckdblabs/sqlite_scanner

Just use an ORM? If you code your workload in Python with SQLAlchemy you can just swap out any (relational) db. If you want to do benchmarking or something, this might not be the best approach, since each db might need some specific tuning to reach full potential.
You could also try using ODBC or ADO.NET. I've not used the latter, but ODBC was my goto for this kind of thing a decade or so ago. So mileage may vary drastically, and there might be roadkill along the way.

https://en.wikipedia.org/wiki/Open_Database_Connectivity