class documentation

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

View In Hierarchy

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.
@classmethod
def argument_for(cls, dialect_name, argument_name, default):

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.

New in version 0.9.4.
Parameters
dialect​_namename 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​_namename of the parameter.
defaultdefault value of the parameter.
def _kw_reg_for_dialect_cls(self, dialect_name):

Undocumented

def _validate_dialect_kwargs(self, kwargs):

Undocumented

_dialect_kwargs_traverse_internals =

Undocumented

_kw_registry =

Undocumented

@util.memoized_property
dialect_kwargs =

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.

New in version 0.9.2.
Changed in version 0.9.4: The .DialectKWArgs.dialect_kwargs collection is now writable.

See Also

.DialectKWArgs.dialect_options - nested dictionary form

@util.memoized_property
dialect_options =

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']
New in version 0.9.2.

See Also

.DialectKWArgs.dialect_kwargs - flat dictionary form

@property
kwargs =
A synonym for .DialectKWArgs.dialect_kwargs.