connect 2 database with primary key and foreign key

16 views
Skip to first unread message

Joel Buitizon

unread,
Feb 8, 2021, 11:41:00 AM2/8/21
to Kivy users support
i currently have 2 database in my app., i want to connect this two database with the use of foreign key and primary key.can someone help me?
scr11.PNG

Andrei Sima

unread,
Feb 10, 2021, 1:31:30 AM2/10/21
to Kivy users support
AFAYK one DB can not have a table relation from a second DB

Workaround:
1.
Manually join the 2 DB`s in order to have just one.
You might want to look at inspectdb from Django or sqlacodegen from SQLALchemy. You might want to have your models defined.

2.
Deal with relations manually making raw SQL calls, can be a pain, and also a bit dangerous if you mess things up.

Your DB should not be at the app level. It should run in a separate service and accessed directly or via an API (second requires more work to be done).
In development, there is no problem in doing so, but in production, you do not want to ship your DB with your application.

____________________
Andrei Sima


On Mon, Feb 8, 2021 at 6:41 PM Joel Buitizon <kuya....@gmail.com> wrote:
i currently have 2 database in my app., i want to connect this two database with the use of foreign key and primary key.can someone help me?
scr11.PNG

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2f1fc9a8-8b94-4f5c-920c-83e8880b2096n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages