Re: Relation between different database?

2019-09-10 Thread ANi
Thanks, Jason. I was trying to connect a table to a view from another database. But it is not allowed to have a foreign key on a view unless I use a materialized view! Problem is solved. ANi於 2019年9月10日星期二 UTC+8上午11時54分28秒寫道: > > Hi, > > I have my asset table in local db which need to

Re: Relation between different database?

2019-09-10 Thread Jason
https://docs.djangoproject.com/en/2.2/topics/db/multi-db/ If you have to do this, Django does support multiple databases. But you’re going to need to handle the data consistency and integrity you’r. -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Relation between different database?

2019-09-10 Thread ANi
the key point is about the relation in* different databases*, if it is possible to have relations, then I don't need to write additional code to access data from the remote one. ANi於 2019年9月10日星期二 UTC+8上午11時54分28秒寫道: > > Hi, > > I have my asset table in local db which need to reference to the

Re: Relation between different database?

2019-09-10 Thread N'BE SORO
Ok you can add an additional column my_id and you give him the unique property = True Le mar. 10 sept. 2019 à 06:00, ANi a écrit : > my real situation as an example. > > *local database* > AssetModel(id, employee, name, barcode, location, value) > > *remote database* > EmployeeView(id, name,

Re: Relation between different database?

2019-09-10 Thread ANi
my real situation as an example. *local database* AssetModel(id, employee, name, barcode, location, value) *remote database* EmployeeView(id, name, department) I am thinking to set employee in AssetModel as an ForeignKey which references to EmployeeView. but it seems to be not allowed --

Re: Relation between different database?

2019-09-09 Thread N'BE SORO
Hello. Give me one example Le mar. 10 sept. 2019 à 03:54, ANi a écrit : > Hi, > > I have my asset table in local db which need to reference to the employee > view from another database. > But I realized that Django might not allow relations across databases, > right? > > so does it means that

Relation between different database?

2019-09-09 Thread ANi
Hi, I have my asset table in local db which need to reference to the employee view from another database. But I realized that Django might not allow relations across databases, right? so does it means that I can only store the employee key as string in the asset table? or other way to