Django querying tables without id - Multi-Database

35 views Asked by At

In this example I have created (https://github.com/axilaris/docker-django-react-celery-redis/), I have implemented multi-database accessing a Postgresdb table that does not have "id" column. (you can find out in the project code /backend/simple/models.py

Referring to my gist (https://gist.github.com/axilaris/123516cdc9023dc02ebac3cba6644dd7), when accessing the model, it prints the error:

django.db.utils.ProgrammingError: column simpletable.id does not exist
LINE 1: SELECT "simpletable"."id", "simpletable"."name", "simpletabl...

here is the definition of the table:

image description

Is there a way to handle this table in Django (as I'm interested to use ORM) without creating a new column id or views. The reason for this is because some external tables, we have no way of making any changes to the table. Can I do something within Django to support this table ?

0

There are 0 answers