Replies: 1 comment
-
OK, this is totally a different problem, and I'm almost there. n/m this one. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
I'm trying to figure out if it's possible to have multiple sets of different SQLModel classes that vary only by
schema
. My usecase is an application that runs from one database instance (Postgres), but uses schemata to segregate customer data. I have implemented the above code, and it runs! But when I runalembic
to generate a migration, the tables are not being defined, because thefoo
andbar
classes aren't being registered in theSQLModel.metadata
.What I'm trying to avoid doing is having to go by hand and create subclass models for each customer by hand, eg
and then having to dispatch to the various classes in the application (FastAPI). If a request comes in from a
foo
customer for access to aBar
object (in schemafoo.bar
), I would love to be able to call a method that returned the appropriate class, so that the routing methods in FastAPI would be purely ignorant of the implementation of the models in the database.Does this make any sense at all?
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.11
Python Version
Python 3.12.0
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions