Shadi
Shadi

Reputation: 10345

django vs qlik sense: naming the ID field "id" vs "table1_id"

Qlik sense recommends that each table's primary key be named something like "table1_id" if the table name is Table1. This allows their "automatic association" to properly detect like-named fields and link them.

On the other hand, the django best practice is to just use the default primary key name "id" for each table, e.g. table named Table1 will have a field called "id", same for a table named Table2, etc.

As such, a django-managed database will not yield optimal ID field names for Qlik Sense's automatic association.

What's the best practice among Qlik Sense + Django users?

Upvotes: 0

Views: 108

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599530

You can always define your own AutoField with primary_key=True and call it whatever you like. What's more, you can then refer to that field via the .pk alias so it will work for any model.

Upvotes: 0

Related Questions