From: Mike Bayer Date: Mon, 19 Aug 2024 15:13:27 +0000 (-0400) Subject: some updates to the commit for multi-tenant I just did X-Git-Tag: rel_1_13_3~7 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=30292b38b73d94d4cea743137c4261cf9a305e1f;p=thirdparty%2Fsqlalchemy%2Falembic.git some updates to the commit for multi-tenant I just did Change-Id: I5e9c03697af5d65f68c37bf4afd6caaf73ce270a --- diff --git a/docs/build/cookbook.rst b/docs/build/cookbook.rst index a9121730..ce5fb543 100644 --- a/docs/build/cookbook.rst +++ b/docs/build/cookbook.rst @@ -789,14 +789,19 @@ the approach must involve running Alembic multiple times against different database URLs. One common approach to multi-tenancy, particularly on the PostgreSQL database, -is to install tenants within **individual PostgreSQL schemas**. When using -PostgreSQL's schemas, a special variable ``search_path`` is offered that is -intended to assist with targeting of different schemas. - -When using MySQL or MariaDB databases, a similar command is available at the -SQL level called the``use`` command. This command may be used in a similar -fashion as that of PostgreSQL's ``search_path`` variable to achieve a similar -effect. +is to install tenants within **individual PostgreSQL schemas**; similarly +when using MySQL/MariaDB, **individual MySQL/MariaDB databases** are addressed +in the same way as "schemas" on PostgreSQL. + +When using PostgreSQL's schemas, a special variable ``search_path`` is offered +that is intended to assist with targeting of different schemas. When using +MySQL or MariaDB databases, a similar command is available at the SQL level +called the ``USE`` command. This command may be used in a similar fashion as +that of PostgreSQL's ``search_path`` variable to achieve a similar effect. + +Overall, this recipe can be used on **any database that supports runtime +modification of the current "tenant" via SQL commands on a particular +connection**. .. note:: SQLAlchemy includes a system of directing a common set of ``Table`` metadata to many schemas called `schema_translate_map `_. Alembic at the time