I've been looking at the fullstack implementation of LiteStar and thought I'd try to copy a couple of features in use. I noticed Advanced Alchemy makes use of their own orm_registry object, which stores all the model information. This is also used in alembic to build up the database.
I want to split my business data from my authentication data, and so have two different databases in play. How can I have two different registries?
The only progress I've made is building two different AsyncConfig objects.
alchemy_auth = SQLAlchemyAsyncConfig(
engine_instance=settings.db_auth.get_engine(),
before_send_handler=autocommit_before_send_handler,
session_config=AsyncSessionConfig(expire_on_commit=False),
alembic_config=AlembicAsyncConfig(
script_config=settings.db_auth.migration_config,
script_location=settings.db_auth.migration_path,
),
)
alchemy_business = SQLAlchemyAsyncConfig(
engine_instance=settings.db_business.get_engine(),
before_send_handler=autocommit_before_send_handler,
session_config=AsyncSessionConfig(expire_on_commit=False),
alembic_config=AlembicAsyncConfig(
script_config=settings.db_business.migration_config,
script_location=settings.db_business.migration_path,
),
)