alembic-multischema
This module provides the ability to act on multiple postgres schemas at once when using alembic.
Functions:
perSchema(**kwargs)
Used to decorate the upgrade() and downgrade() functions in a migration. When upgrade or downgrade are decorated with perSchema() the decorated function will be called for a list of schemas in the current database.
kwargs:
- schemas A list of schema names to run the function against. If omitted perSchema() will automatically generate a list of non-system schemas from the current database by using getAllNonSystemSchemas()
- exclude A list of schema names to exclude from running the function against
getAllSchemas()
Returns a list of all schemas in the current database.
kwargs:
- exclude A list of schema names to exclude from running the function against
getAllNonSystemSchemas()
Returns a list of schemas in the current database, omitting information_schema and pg_catalog.
kwargs:
- exclude A list of schema names to exclude from running the function against
Example Usage:
"""CreateUsersTable
Revision ID: a6a219646b55
Revises:
Create Date: 2019-10-16 14:43:11.347575
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
from almebic_multischema import perSchema
# revision identifiers, used by Alembic.
revision = 'a6a219646b55'
down_revision = None
branch_labels = None
depends_on = None
@perSchema(schemas=["public", "foo", "bar"])
def upgrade():
users = text(
"""CREATE TABLE users
(
id serial PRIMARY KEY,
firstname VARCHAR (50) UNIQUE,
lastname VARCHAR (50)
);
""")
op.execute(users)
@perSchema(schemas=["public", "foo", "bar"])
def downgrade():
op.execute(text("DROP TABLE users"))
Metadata
Release files for alembic-multischema 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| alembic_multischema-0.0.7-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for alembic_multischema-0.0.7-py2.py3-none-any.whl |
Release files / alembic_multischema-0.0.7-py2.py3-none-any.whl
| Download URL | alembic_multischema-0.0.7-py2.py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9ebfb586cf3e2787f371c669395ce221136f744d39a31f8fa1f84b49bc95a19f
|
|
BLAKE2b-256 checksum How to use checksums |
508cf61a98a9fe8889dd54b16cbfdc1c62cd8801c5936009cea51fee0baec426
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/2.7.16
|
Security for alembic-multischema 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.