sqlalchemy_boltons package¶
Submodules¶
sqlalchemy_boltons.core module¶
- sqlalchemy_boltons.core.bytes_startswith(operand, prefix)[source]¶
Produces SQL equivalent to
operand.startswith(prefix), but which works correctly for BLOB-like columns.As an example, the resulting SQL for
bytes_startswith(x, b"abc")is something like(x >= b"abc") & (x < b"abd").- Return type:
ColumnElement[object]
sqlalchemy_boltons.orm module¶
- class sqlalchemy_boltons.orm.IdKey(mapped, key, identity_token)[source]¶
Bases:
Generic[T]Holds the primary key information for an ORM instance. This is useful for passing a reference to an ORM object across different sessions and/or threads.
For example:
import sqlalchemy as sa from sqlalchemy import orm as sao from sqlalchemy_boltons.orm import IdKey Base = sao.declarative_base() class MyClass(Base): __tablename__ = "my_table" id = sa.Column(sa.Integer, primary_key=True) session = Session() instance = session.execute(sa.select(MyClass).where(...)).one() key = IdKey.from_instance(instance) # ...later... session = Session() instance = key.get_one(session)
- get(_session, **kw)[source]¶
Shortcut for
session.get(k.mapped, k.key, identity_token=k.identity_token).- Return type:
Optional[TypeVar(T)]
- get_one(_session, **kw)[source]¶
Like
get(), but raisessqlalchemy.exc.NoResultFoundif no row is found.- Return type:
TypeVar(T)
-
identity_token:
Any¶
-
key:
tuple¶
-
mapped:
type[TypeVar(T)]¶
- class sqlalchemy_boltons.orm.RelationshipComparator(relationship)[source]¶
Bases:
objectThis wrapper makes it possible to compare a table against a relationship using
join_expr(). This can be used for constructing a subquery that filters using a relationship to a table from the outer query.For example:
import sqlalchemy as sa from sqlalchemy import orm as sao from sqlalchemy_boltons.orm import RelationshipComparator as Rel Base = sao.declarative_base() class Parent(Base): __tablename__ = "parent" id = sa.Column(sa.Integer, primary_key=True) children = sao.relationship("Child", back_populates="parent") class Child(Base): __tablename__ = "child" id = sa.Column(sa.Integer, primary_key=True) parent_id = sa.Column(sa.ForeignKey("parent.id"), index=True) parent = sao.relationship("Parent", back_populates="children") # We want a query that selects every Parent that has at least one child. We also want to use aliases. P = sao.aliased(Parent) C = sao.aliased(Child) # This is the boring old way of doing it, which requires explicitly stating the filtering conditions in terms # of the columns in both tables. q1 = sa.select(P).where(sa.select(C).where(C.parent_id == P.id).exists()) # Reuse the filtering conditions from the ORM relationship! q2 = sa.select(P).where(sa.select(C).where(Rel(C.parent) == P).exists()) assert str(q1) == str(q2), "these should produce the same SQL code!"
Based on this discussion: https://groups.google.com/g/sqlalchemy/c/R-qOlzzVi0o/m/NtFswgJioDIJ
- class sqlalchemy_boltons.orm.Relationships(tables, names, primary, secondary=None, kwargs=<factory>)[source]¶
Bases:
objectGenerates pairs of relationships. It’s like the legacy “backref” parameter but it allows you to configure each side of the relationship separately.
For example:
_rel_children_parent = _orm.Relationships( lambda: dict(a=Parent, b=Child), dict(ab="children", ba="parent"), lambda fk, a, b: a.id == fk(b.parent_id), ) class Parent(Base): __tablename__ = "parent" id = sa.Column(sa.Integer, primary_key=True) children = _rel_children_parent.a_to_b(viewonly=True) class Child(Base): __tablename__ = "child" id = sa.Column(sa.Integer, primary_key=True) parent_id = sa.Column(sa.ForeignKey("parent.id")) parent = _rel_children_parent.b_to_a(viewonly=True)
-
kwargs:
dict¶
-
names:
dict[str,str]¶
-
primary:
Callable¶
-
secondary:
Optional[Callable] = None¶
-
tables:
Callable¶
-
kwargs:
sqlalchemy_boltons.reset module¶
- sqlalchemy_boltons.reset.install_reset_auto(engine)[source]¶
Install the reset event handler for engine. This function automatically detects the right resetter to install, and raises an exception if the SQL dialect is not supported.
Important: You should disable the default reset handler (which just does a rollback) using
create_engine(..., pool_reset_on_return=False).- Return type:
None
- sqlalchemy_boltons.reset.install_reset_generic(engine)[source]¶
Default resetter which only does a rollback.
- sqlalchemy_boltons.reset.install_reset_mssql(engine)[source]¶
This calls a semi-documented stored procedure called “sys.sp_reset_connection” which does lots of cleanup actions.
References:
- sqlalchemy_boltons.reset.install_reset_postgresql(engine)[source]¶
Postgresql requires additional commands to end all transactions in progress and discard temporary tables.
References:
sqlalchemy_boltons.slow module¶
sqlalchemy_boltons.sqlite module¶
- class sqlalchemy_boltons.sqlite.Begin(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enumhttps://www.sqlite.org/lang_transaction.html
Note that CONCURRENT is only available on a specific SQLite branch, not mainline.
- CONCURRENT = 4¶
- DEFERRED = 1¶
- EXCLUSIVE = 3¶
- IMMEDIATE = 2¶
- class sqlalchemy_boltons.sqlite.ForeignKeys(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enumhttps://www.sqlite.org/pragma.html#pragma_foreign_keys
- DEFERRED = 2¶
- IMMEDIATE = 3¶
- OFF = 1¶
- class sqlalchemy_boltons.sqlite.Journal(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enumhttps://www.sqlite.org/pragma.html#pragma_journal_mode
Note that WAL2 is only available on a specific SQLite branch, not mainline.
- DELETE = 1¶
- MEMORY = 4¶
- OFF = 7¶
- PERSIST = 3¶
- TRUNCATE = 2¶
- WAL = 5¶
- WAL2 = 6¶
- class sqlalchemy_boltons.sqlite.Memory[source]¶
Bases:
objectWe keep a reference to an open connection because SQLite will free up the database otherwise. You must hold a reference to this object or else the database will be freed.
Note that you still can’t get concurrent readers and writers because you cannot currently set WAL mode on an in-memory database. See https://sqlite.org/forum/info/6700ab1f9f6e8a00
- connection_reference = None¶
-
uri:
str¶
- class sqlalchemy_boltons.sqlite.Options(*, timeout, begin, foreign_keys, recursive_triggers, trusted_schema, schemas, encoding='UTF-8', ignore_check_constraints=False)[source]¶
Bases:
_OptionsMixinRepresents the options that are applied to a SQLite database connection at the start of every transaction. These options are mostly in the form of “PRAGMA” statements.
Use
new()as a convenient constructor that automatically resolves strings to enum values.- Parameters:
timeout¶ (
float|int|None) – Number of seconds to wait when a table is locked. Set this toNoneif you are using your own custom busy handler viasqlite3_busy_handler. See https://www.sqlite.org/c3ref/busy_timeout.html for more.begin¶ (
Begin) – Controls the type of transaction. Use DEFERRED for read-only transactions and IMMEDIATE for read-write transactions.foreign_keys¶ (
ForeignKeys) – Controls the enforcement of foreign keys.trusted_schema¶ (
bool) – Can we trust the database schema? Set this to False if the database file comes from an untrusted source. See https://www.sqlite.org/src/doc/latest/doc/trusted-schema.md for more information.recursive_triggers¶ (
bool) – Can the execution of a database trigger also cause the execution of another database trigger, and so on? This feature was added in SQLite in 2009, but it is turned off by default as it is a breaking change.schemas¶ (
immutabledict[str,SchemaOptions]) – Contains per-schema configuration options. SeeSchemaOptions. You should have at least one entry for the “main” database.encoding¶ (
str) – Encoding used for the text. Only a few values are supported according to https://www.sqlite.org/pragma.html#pragma_encoding and it can only be set on a brand new database.ignore_check_constraints¶ (
bool) – This option can be used to temporarily disable CHECK constraints.
-
_cached_begin_commands:
ClassVar[None|tuple[str,...]] = None¶
- apply(configurable)[source]¶
- Parameters:
configurable¶ (
Engine|Any) – Engine or connection that will be configured to use this Options object.
- classmethod apply_lambda(configurable, function)[source]¶
Get the current options for configurable, pass them to function to produce a new options object, then
apply()those options to configurable.
- static convert_kwargs(kw)[source]¶
This method is called to modify the current constructor keyword arguments in-place. Typically this is done to convert strings to enum members using
_convert_enum().
-
encoding:
str= 'UTF-8'¶
- evolve(**kw)¶
Make a copy of the current options block but with keyword arguments **changes applied to replace some of the attributes.
- evolve_schema(schema_name, **changes)[source]¶
Make a copy of the current options block but with keyword arguments **changes applied to
schemas[schema_name]usingSchemaOptions.evolve().- Parameters:
schema_name¶ (
str) – Name of theSchemaOptionsthat will be updated (by making a new copy).**changes¶ – Changes to be made to the
SchemaOptions.
-
foreign_keys:
ForeignKeys¶
- classmethod get(configurable)[source]¶
Return the options configured on configurable. Raises KeyError if none is set.
-
ignore_check_constraints:
bool= False¶
- classmethod new(**kw)¶
Alternative constructor which automatically converts strings into enum values.
-
recursive_triggers:
bool¶
-
schemas:
immutabledict[str,SchemaOptions]¶
-
timeout:
float|int|None¶
-
trusted_schema:
bool¶
- class sqlalchemy_boltons.sqlite.SQLAlchemySqliteTransactionFix[source]¶
Bases:
objectThis class exists because sqlalchemy doesn’t automatically fix pysqlite’s stupid default behaviour. Additionally, we implement support for foreign keys and other options.
Use
Options.new()to construct the options and thenOptions.apply()them to yoursa.Engine.
- class sqlalchemy_boltons.sqlite.SchemaOptions(*, synchronous, journal=None, journal_size_limit=None, secure_delete=SecureDelete.OFF)[source]¶
Bases:
_OptionsMixinOptions specific to one schema (one ATTACHed database file).
Use
new()as a convenient constructor that automatically resolves strings to enum values.- Parameters:
synchronous¶ (
Synchronous) – Higher levels are slower but provide more resilience to corruption in case of a sudden power failure or crash. Conversely, lower levels can be faster by orders of magnitude, at the cost of likely corruption in case of an unexpected power failure.journal¶ (
Journal|None) – Journal mode. WAL is usually a good choice.journal_size_limit¶ (
int|None) – The journal file may be left in place after a transaction ends, depending on your settings. To avoid it from taking up too much space, this option tells SQLite to trim down the journal file size down to journal_size_limit after the end of a transaction. Use 0 to trim it down to its minimum size. Use -1 to allow it to grow unbounded.secure_delete¶ (
SecureDelete) – Controls the “overwrite with zeros” anti-forensic mechanism. Note that there are still some caveats, which you should read about at https://www.sqlite.org/pragma.html#pragma_secure_delete
- static convert_kwargs(kw)[source]¶
This method is called to modify the current constructor keyword arguments in-place. Typically this is done to convert strings to enum members using
_convert_enum().
- evolve(**kw)¶
Make a copy of the current options block but with keyword arguments **changes applied to replace some of the attributes.
-
journal_size_limit:
int|None= None¶
- classmethod new(**kw)¶
Alternative constructor which automatically converts strings into enum values.
-
secure_delete:
SecureDelete= 1¶
-
synchronous:
Synchronous¶
- class sqlalchemy_boltons.sqlite.SecureDelete(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enumhttps://www.sqlite.org/pragma.html#pragma_secure_delete
- FAST = 2¶
- OFF = 1¶
- ON = 3¶
- class sqlalchemy_boltons.sqlite.Synchronous(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enumhttps://www.sqlite.org/pragma.html#pragma_synchronous
- EXTRA = 4¶
- FULL = 3¶
- NORMAL = 2¶
- OFF = 1¶
- class sqlalchemy_boltons.sqlite._OptionsMixin[source]¶
Bases:
ABCCommon constructor code used for both
OptionsandSchemaOptions.- abstract convert_kwargs(kw)[source]¶
This method is called to modify the current constructor keyword arguments in-place. Typically this is done to convert strings to enum members using
_convert_enum().
- sqlalchemy_boltons.sqlite.create_engine_sqlite(path, *, parameters=(), check_same_thread=False, create_engine_args=None, create_engine=None, transaction_fix=True)[source]¶
Create a sqlite engine.
- Parameters:
path¶ (
Path|str|Memory) – Path to the db file, or aMemoryobject. The same memory object can be shared across multiple engines.parameters¶ (
Iterable[tuple[str|bytes,str|bytes]]) – SQLite URI query parameters as described in https://www.sqlite.org/uri.htmlcheck_same_thread¶ (
bool|None) – Defaults to False. See https://docs.python.org/3/library/sqlite3.html#sqlite3.connectcreate_engine_args¶ (
dict|None) – Keyword arguments to be passed tosa.create_engine().create_engine¶ (
Optional[Callable]) – If provided, this will be used instead ofsa.create_engine(). You can use this to further customize the engine creation.transaction_fix¶ (
SQLAlchemySqliteTransactionFix|bool) – SeeSQLAlchemySqliteTransactionFix. If True, then instantiate one. If False, then do not apply the fix. (default: True)
- Return type:
Engine
sqlalchemy_boltons.temporary module¶
- class sqlalchemy_boltons.temporary.CacheTemporaryMetaData(creator_function, global_prefix='tmp__')[source]¶
Bases:
Generic[T]This holds a cache of the generated metadata (tables, indices, etc).
Calling an instance gives you a context manager that creates a temporary table which is valid within the current “with” block. The temporary table is dropped as soon as the “with” block completes.
By default, this function creates the table in a brand new
sqlalchemy.MetaData. If you want to create the table inside an existing one, then pass in the metadata argument.If you want something that persists past the end of the transaction, then you probably want an actual persistent table. If you think about it some more, you will realize that you probably also want some way to keep track of these semi-persistent tables, and automatically discard them if they are too old. We will someday provide a way to do that too, maybe.
Tested on SQLite, Postgres, and MariaDB/MySQL.
Based on https://github.com/sqlalchemy/sqlalchemy/discussions/9400
-
creator_function:
Union[Table,Callable[[TemporaryMetaDataMaker],TypeVar(T)]]¶
- get(bind, prefix, suffix='', cache=True)[source]¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
-
global_prefix:
str= 'tmp__'¶
-
creator_function:
- class sqlalchemy_boltons.temporary.MetaDataMaker[source]¶
Bases:
ABC- abstract configure_table(table)[source]¶
This method is called to fully configure a table.
- Return type:
None
- abstract copy_table(table, name=None, referred_schema_fn=None)[source]¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
- Return type:
Table
-
metadata:
MetaData¶
- run(function)[source]¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- class sqlalchemy_boltons.temporary.MetaDataMakerMixinUseDefaultCopyTable[source]¶
Bases:
MetaDataMaker- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- abstract configure_table(table)¶
This method is called to fully configure a table.
- Return type:
None
- copy_table(*args, **kwargs)[source]¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
- finish()¶
You must call this method after adding all the tables.
-
metadata:
MetaData¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- abstract table_name(name)¶
Return the transformed table name. Usually a prefix and/or suffix are added.
- Return type:
str
- class sqlalchemy_boltons.temporary.MetaDataMakerResult(maker, value)[source]¶
Bases:
Generic[T]-
maker:
MetaDataMaker¶
-
value:
TypeVar(T)¶
-
maker:
- class sqlalchemy_boltons.temporary.Naming(prefix, suffix)[source]¶
Bases:
object-
prefix:
str¶
-
suffix:
str¶
-
prefix:
- class sqlalchemy_boltons.temporary.TemporaryMetaDataMaker(dialect, naming)[source]¶
Bases:
MetaDataMaker,ABC- AUTO_REGISTER = True¶
- DIALECT_NAME_TO_CLASS = {'mariadb': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb'>, 'mysql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql'>, 'postgresql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql'>, 'sqlite': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite'>}¶
- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- abstract configure_table(table)¶
This method is called to fully configure a table.
- Return type:
None
- abstract copy_table(table, name=None, referred_schema_fn=None)¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
- Return type:
Table
-
dialect:
Dialect¶
- finish()¶
You must call this method after adding all the tables.
-
metadata:
MetaData¶
-
naming:
Callable[[str],str]¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- class sqlalchemy_boltons.temporary.TemporaryMetaDataMakerFallback(dialect, naming)[source]¶
Bases:
TemporaryMetaDataMaker,MetaDataMakerMixinUseDefaultCopyTable- AUTO_REGISTER = False¶
- DIALECT_NAME_TO_CLASS = {'mariadb': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb'>, 'mysql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql'>, 'postgresql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql'>, 'sqlite': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite'>}¶
- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- abstract configure_table(table)¶
This method is called to fully configure a table.
- Return type:
None
- copy_table(*args, **kwargs)¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
-
dialect:
Dialect¶
- finish()¶
You must call this method after adding all the tables.
- classmethod get_class_for_engine(engine)¶
-
metadata:
MetaData¶
-
naming:
Callable[[str],str]¶
- classmethod register_fallback_for_dialect(dialect)¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- class sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb(dialect, naming)[source]¶
Bases:
TemporaryMetaDataMaker,MetaDataMakerMixinUseDefaultCopyTable- AUTO_REGISTER = True¶
- DIALECT_NAME_TO_CLASS = {'mariadb': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb'>, 'mysql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql'>, 'postgresql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql'>, 'sqlite': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite'>}¶
- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- copy_table(*args, **kwargs)¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
-
dialect:
Dialect¶
- finish()¶
You must call this method after adding all the tables.
- classmethod get_class_for_engine(engine)¶
-
metadata:
MetaData¶
-
naming:
Callable[[str],str]¶
- classmethod register_fallback_for_dialect(dialect)¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- table_name(name)¶
Return the transformed table name. Usually a prefix and/or suffix are added.
- class sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql(dialect, naming)[source]¶
Bases:
TemporaryMetaDataMaker_mariadb- AUTO_REGISTER = True¶
- DIALECT_NAME_TO_CLASS = {'mariadb': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb'>, 'mysql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql'>, 'postgresql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql'>, 'sqlite': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite'>}¶
- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- classmethod configure_table(table)¶
This method is called to fully configure a table.
- copy_table(*args, **kwargs)¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
-
dialect:
Dialect¶
- finish()¶
You must call this method after adding all the tables.
- classmethod get_class_for_engine(engine)¶
-
metadata:
MetaData¶
-
naming:
Callable[[str],str]¶
- classmethod register_fallback_for_dialect(dialect)¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- table_name(name)¶
Return the transformed table name. Usually a prefix and/or suffix are added.
- class sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql(dialect, naming)[source]¶
Bases:
TemporaryMetaDataMaker,MetaDataMakerMixinUseDefaultCopyTable- AUTO_REGISTER = True¶
- DIALECT_NAME_TO_CLASS = {'mariadb': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb'>, 'mysql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql'>, 'postgresql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql'>, 'sqlite': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite'>}¶
- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- copy_table(*args, **kwargs)¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
-
dialect:
Dialect¶
- finish()¶
You must call this method after adding all the tables.
- classmethod get_class_for_engine(engine)¶
-
metadata:
MetaData¶
-
naming:
Callable[[str],str]¶
- classmethod register_fallback_for_dialect(dialect)¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- table_name(name)¶
Return the transformed table name. Usually a prefix and/or suffix are added.
- class sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite(dialect, naming)[source]¶
Bases:
TemporaryMetaDataMaker,MetaDataMakerMixinUseDefaultCopyTable- AUTO_REGISTER = True¶
- DIALECT_NAME_TO_CLASS = {'mariadb': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mariadb'>, 'mysql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_mysql'>, 'postgresql': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_postgresql'>, 'sqlite': <class 'sqlalchemy_boltons.temporary.TemporaryMetaDataMaker_sqlite'>}¶
- static _as_table(table)¶
- _init_metadata()¶
- _make_metadata_kwargs()¶
- copy_table(*args, **kwargs)¶
Make a copy of an existing table using
sa.Table.to_metadata().Subclasses must choose to support this method or raise NotImplementedError.
-
dialect:
Dialect¶
- finish()¶
You must call this method after adding all the tables.
- classmethod get_class_for_engine(engine)¶
-
metadata:
MetaData¶
-
naming:
Callable[[str],str]¶
- classmethod register_fallback_for_dialect(dialect)¶
- run(function)¶
- Return type:
MetaDataMakerResult[TypeVar(T)]
- table_name(name)¶
Return the transformed table name. Usually a prefix and/or suffix are added.