Hacker News new | ask | show | jobs
by 3np 1718 days ago
(2014)

One case where I still think ORMs like SQLAlchemy make a great sense is in open-source software than can be configured to work with different databases (lime SQLite/Postgres/Maria).

If you own the entire stack and can control what FB the software is used with, fine, but it can be worth trading some performance to flexibility.

2 comments

I think supporting multiple databases is an antipattern for most software (open source or not). Being able to change the database driver does not qualify as support.

If you really do want to support multiple databases, you need to write code with all of them in mind and test with them, not just leave it to users to find all the bugs when they change the DB driver to something no-one else actually uses.

I disagree. If you don't need any database-specific funtionality, are OK with the least-common denominator, why not?

I run a large number of open-source software privately. It would be a way smaller number if I couldn't use them with Postgres.

Many users and projects will start on sqlite but as they mature migrate to clustered instances of a hosted database. It's great that this can be supported without each project implementing every DB.

I have been the user hitting a bug (which I was able to submit a fix for) in the scenario you describe. I much prefer that to not using the software at all or setting up a MySQL instance.

You know what works really well regardless of database? Regular boring old Ansii SQL without vendor-specific addins.
Sure, but you'd still need to connect and interface with the SQL implementations - the queries themselves are the smaller piece of the work if you want to support several different database backends.
> the queries themselves are the smaller piece of the work if you want to support several different database backends.

Not if you use something like the Delphi / Lazarus model with pluggable drivers and direct SQL capability (and stick to whichever variant of ANSI-standard SQL your intended backends have in common).