-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select postgres schema connection #11
Comments
Hello. Why would you use sessions with Saffier or Edgy? So, both use an underlying tool that manages the database connections and the sessions like the ones used in SQL Alchemy ORM are managed internally. Now, Saffier and Edgy use SQLAlchemy Core. But if you really want that, then you can use the connection object used in both Saffier and Edgy. Lets use the following example. from edgy import Database, Registry
database = Database("postgresql+asyncpg://postgres:postgres@localhost:5432/my_db")
models = Registry(database=database)
... The objects managing the connections are the database and registry. The registry holds your model information tables and the databases the connections. So switching would be updating both of them and keep using the ORM as normal. Edgy and Saffier use the underlying technology (https://databasez.tarsild.io/) to manage the DB connections automatically for you. The I hope this helps :) |
Thank you for answer. I want to make multitenant app with schema per tenant and need to execute queries with specific schema |
I suspected that from the type of question. I did something similar when I was using Django as well. The thing is that depends of your approach. Multi tenancy you can have in 3 ways.
I hope I was able to answer your questions? Also, thank you for choosing Edgy :) |
I prefer second option "Shared database, multiple schemas". |
I actually like the idea but It would be better to see a possible PR with your idea there. Do you have the chance to create one? That would be a good addition 👍🏼 |
I'm afraid that I don't have enough experience and skills to do this, but I will try |
Give it a try. Add this idea also to the Discussion section of Edgy as an idea. This is a good one. |
Closing here as this was moved to discussion #14 |
Please tell me, how can I switch to another postgres schema when doing queries or making migrations?
In sqlalchemy we can do
And then use
session
in api.How to do that with edgy or saffier?
The text was updated successfully, but these errors were encountered: