_convert_modname_w_class = {
("sqlalchemy.engine.interfaces", "Connectable"): "sqlalchemy.engine",
+ ("sqlalchemy.sql.base", "DialectKWArgs"): "sqlalchemy.sql.base",
}
def _adjust_rendered_mod_name(modname, objname):
- if modname in _convert_modname:
- return _convert_modname[modname]
- elif (modname, objname) in _convert_modname_w_class:
+ if (modname, objname) in _convert_modname_w_class:
return _convert_modname_w_class[(modname, objname)]
+ elif modname in _convert_modname:
+ return _convert_modname[modname]
else:
return modname
Constraints API
---------------
.. autoclass:: Constraint
-
+ :members:
.. autoclass:: CheckConstraint
-
+ :members:
+ :inherited-members:
.. autoclass:: ColumnCollectionConstraint
-
+ :members:
.. autoclass:: ForeignKey
:members:
+ :inherited-members:
.. autoclass:: ForeignKeyConstraint
:members:
+ :inherited-members:
.. autoclass:: PrimaryKeyConstraint
+ :members:
+ :inherited-members:
.. autoclass:: UniqueConstraint
+ :members:
+ :inherited-members:
.. _schema_indexes:
.. autoclass:: Index
:members:
+ :inherited-members:
"""Optional set of argument specifiers for various SQLAlchemy
constructs, typically schema items.
- To
- implement, establish as a series of tuples, as in::
+ To implement, establish as a series of tuples, as in::
construct_arguments = [
(schema.Index, {
]
If the above construct is established on the Postgresql dialect,
- the ``Index`` construct will now accept additional keyword arguments
- such as ``postgresql_using``, ``postgresql_where``, etc. Any kind of
- ``postgresql_XYZ`` argument not corresponding to the above template will
- be rejected with an ``ArgumentError`, for all those SQLAlchemy constructs
- which implement the :class:`.DialectKWArgs` class.
-
- The default is ``None``; older dialects which don't implement the argument
- will have the old behavior of un-validated kwargs to schema/SQL constructs.
+ the :class:`.Index` construct will now accept the keyword arguments
+ ``postgresql_using``, ``postgresql_where``, nad ``postgresql_ops``.
+ Any other argument specified to the constructor of :class:`.Index`
+ which is prefixed with ``postgresql_`` will raise :class:`.ArgumentError`.
+
+ A dialect which does not include a ``construct_arguments`` member will
+ not participate in the argument validation system. For such a dialect,
+ any argument name is accepted by all participating constructs, within
+ the namespace of arguments prefixed with that dialect name. The rationale
+ here is so that third-party dialects that haven't yet implemented this
+ feature continue to function in the old way.
+
+ .. versionadded:: 0.9.2
+
+ .. seealso::
+
+ :class:`.DialectKWArgs` - implementing base class which consumes
+ :attr:`.DefaultDialect.construct_arguments`
+
"""
class DialectKWArgs(object):
"""Establish the ability for a class to have dialect-specific arguments
- with defaults and validation.
+ with defaults and constructor validation.
+
+ The :class:`.DialectKWArgs` interacts with the
+ :attr:`.DefaultDialect.construct_arguments` present on a dialect.
+
+ .. seealso::
+
+ :attr:`.DefaultDialect.construct_arguments`
"""
some_index = Index('a', 'b', mydialect_length=5)
The :meth:`.DialectKWArgs.argument_for` method is a per-argument
- way adding extra arguments to the :attr:`.Dialect.construct_arguments`
+ way adding extra arguments to the :attr:`.DefaultDialect.construct_arguments`
dictionary. This dictionary provides a list of argument names accepted by
various schema-level constructs on behalf of a dialect.
:param dialect_name: name of a dialect. The dialect must be locatable,
else a :class:`.NoSuchModuleError` is raised. The dialect must
- also include an existing :attr:`.Dialect.construct_arguments` collection,
+ also include an existing :attr:`.DefaultDialect.construct_arguments` collection,
indicating that it participates in the keyword-argument validation and
default system, else :class:`.ArgumentError` is raised.
If the dialect does not include this collection, then any keyword argument