Advice on attribute naming convention for a Python-Pydantic-FastAPI/DynamoDB/React App

Question:

I’m building an App with a Python-Pydantic-FastAPI API, a DynamoDB persistence layer and a React front-end and am looking for advice on attribute naming conventions.

The dilemma is that these three basically have 3 different naming conventions.

Python: snake_case

DynamoDB: PascalCase

React: camelCase

So what do people usually do in these circumstances, to cut-out interoperability issues I’m currently planning on using PascalCase through out.
I.e.

Having Pydantic models like

class User(BaseModel):
    Name: str

Storing in DynamoDB as

{"Name": "Jim"}

And sending over the wire in JSON as

'{"Name": "Jim"}'

Is there a standard way in which people usually approach this?

Asked By: Roger Thomas

||

Answers:

DynamoDB doesn’t care about which case you use, it can be a mix of you like, but of course you don’t want a mix for your application side.

I would suggest picking the case which you use in your application the most.

Answered By: Lee Hannigan