Quick note on this, since you're using node. I've found that knex is a great tool for building queries imperatively in node. It's not an ORM (which many say is an anti-pattern and I tend to agree).
If you use knex, you have this option:
Step 1. Use wrapIdentifier
to convert from camel to snake
Step 2. Use postProcessResponse
to convert from snake to camel
lodash has snakeCase
and camelCase
functions that should come in handy.
The reason I recommend these methods is because if you don't do this, you will either have to write your code using snake case variables (which is very idiosyncratic for JS), or you'll have to name your db columns in camel case (and constantly be wrapping your SQL query column names in "
), or you'll have to have a bunch of code with the sole purpose of converting between the two.
Footnote:
I've also found that Objection is an ORM that defies a lot of the typical arguments against ORMs and is quite useful. It sits on top of knex and provides a huge API for interacting with your database in ways that don't completely abstract away the fact that you're interacting with a database. Here's an article on this topic in relation to Objection.