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

Time:11-14

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?

CodePudding user response:

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.

  • Related