Posts for: #Postgres

Using UUIDs as Primary Keys with Django and Postgres

By default, Django creates integer primary keys (32 bits) when used with PostgreSQL database. These fields are incremented automatically and work perfectly well in a local environment. A problem that appears when you create an API is the fact that sequential and numeric IDs expose details of your database.

Imagine your client has ID 1; they can imagine (and rightly so) that it’s their first client. The same can be used by competitors to know how many new clients you’ve obtained in a certain period, just by creating a new account. This may generate an uncontrollable desire in some people to explore the values of your keys.

Read more

Using UUIDs as Primary Keys with Django and Postgres

By default, Django creates integer primary keys (32 bits) when used with PostgreSQL database. These fields are incremented automatically and work perfectly well in a local environment. A problem that appears when you create an API is the fact that sequential and numeric IDs expose details of your database.

Imagine your client has ID 1; they can imagine (and rightly so) that it’s their first client. The same can be used by competitors to know how many new clients you’ve obtained in a certain period, just by creating a new account. This may generate an uncontrollable desire in some people to explore the values of your keys.

Read more