class DialectKWArgs(object):
Known subclasses: sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.schema.Column
, sqlalchemy.sql.schema.Constraint
, sqlalchemy.sql.schema.ForeignKey
, sqlalchemy.sql.schema.Index
, sqlalchemy.sql.schema.Table
Establish the ability for a class to have dialect-specific arguments with defaults and constructor validation.
The .DialectKWArgs
interacts with the
.DefaultDialect.construct_arguments
present on a dialect.
See Also
.DefaultDialect.construct_arguments
Class Method | argument_for |
Add a new kind of dialect-specific keyword argument for this class. |
Method | _kw_reg_for_dialect_cls |
Undocumented |
Method | _validate_dialect_kwargs |
Undocumented |
Class Variable | _dialect_kwargs_traverse_internals |
Undocumented |
Class Variable | _kw_registry |
Undocumented |
Property | dialect_kwargs |
A collection of keyword arguments specified as dialect-specific options to this construct. |
Property | dialect_options |
A collection of keyword arguments specified as dialect-specific options to this construct. |
Property | kwargs |
A synonym for .DialectKWArgs.dialect_kwargs . |
Add a new kind of dialect-specific keyword argument for this class.
E.g.:
Index.argument_for("mydialect", "length", None) some_index = Index('a', 'b', mydialect_length=5)
The .DialectKWArgs.argument_for
method is a per-argument
way adding extra arguments to the
.DefaultDialect.construct_arguments
dictionary. This
dictionary provides a list of argument names accepted by various
schema-level constructs on behalf of a dialect.
New dialects should typically specify this dictionary all at once as a data member of the dialect class. The use case for ad-hoc addition of argument names is typically for end-user code that is also using a custom compilation scheme which consumes the additional arguments.
Parameters | |
dialect_name | name of a dialect. The dialect must be
locatable, else a .NoSuchModuleError is raised. The
dialect must also include an existing
.DefaultDialect.construct_arguments collection, indicating
that it participates in the keyword-argument validation and default
system, else .ArgumentError is raised. If the dialect does
not include this collection, then any keyword argument can be
specified on behalf of this dialect already. All dialects packaged
within SQLAlchemy include this collection, however for third party
dialects, support may vary. |
argument_name | name of the parameter. |
default | default value of the parameter. |
A collection of keyword arguments specified as dialect-specific options to this construct.
The arguments are present here in their original <dialect>_<kwarg>
format. Only arguments that were actually passed are included;
unlike the .DialectKWArgs.dialect_options
collection, which
contains all options known by this dialect including defaults.
The collection is also writable; keys are accepted of the form <dialect>_<kwarg> where the value will be assembled into the list of options.
.DialectKWArgs.dialect_kwargs
collection is now writable.See Also
.DialectKWArgs.dialect_options
- nested dictionary form
A collection of keyword arguments specified as dialect-specific options to this construct.
This is a two-level nested registry, keyed to <dialect_name> and <argument_name>. For example, the postgresql_where argument would be locatable as:
arg = my_object.dialect_options['postgresql']['where']
See Also
.DialectKWArgs.dialect_kwargs
- flat dictionary form