HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Should I not use camelCase in my column names?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
columnnamescamelcaseshouldusenot

Problem

I am creating a GraphQL API using Node.js, which foces me to return all the field names in camelCase.

In my PostgreSQL database, I currently have all my columns named following a camelCase convention, but I am thinking: is that the best idea?

Should I use snake_case in the database columns and convert them in the back-end?

Solution

Use lower case in Postgres. Postgres folds identifiers to lowercase, unless you double-quote your identifiers. To make Postgres operations easier, use lower_snake. If you need to bind to an API, etc, you can create a view with “CamelCase” aliases. For example, we do this with data stored in Postgres that is pulled by Domo.

Context

StackExchange Database Administrators Q#250943, answer score: 14

Revisions (0)

No revisions yet.