Inquiry on Multi-Tenancy Schema Creation and Migration Using Piccolo #920
Replies: 2 comments 17 replies
-
It sounds like for each user you want to create a new schema, with the identical database tables. While Piccolo does allow you to specify which schema a table belongs to: class MyTable(Table, schema="schema_1"):
... There isn't a way to tell the database migrations to create tables in multiple schemas simultaneously. Maybe you can create a database per client instead. You could then have a script like this (specifying which database credentials to use each time):
It's probably not what you're after though. I'll have a think if there's a better solution. There are probably some creative solutions which will make it work. |
Beta Was this translation helpful? Give feedback.
-
hello @dantownsend , i keep getting According to the example on the documentation on many to many both, the joining key must be added to both table that the joining key reference. |
Beta Was this translation helpful? Give feedback.
-
I am currently engaged in the development of a SaaS application that employs a multi-tenant architecture with PostgreSQL as the database system. In this setup, each tenant is allocated a unique schema that contains all the necessary tables specific to their data.
Upon reviewing the available documentation, I have identified a section that describes the modification of the schema within the table definition by passing the schema as an argument to the table class. However, I seek further clarification on the following points:
Is there a provision within the piccolo to automatically generate a separate schema for each new tenant upon registration?
Can the Piccolo migration tools be utilized to facilitate the migration of the database schema for each tenant?
Your assistance is pivotal to the progress of my project, and I would greatly appreciate any guidance or resources you could provide on these matters.
Thank you for your attention to this inquiry.
Beta Was this translation helpful? Give feedback.
All reactions