diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-25 20:10:52 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-25 20:10:52 -0500 |
commit | f9492ef90641c2fa55bcd1ecc93ddcef7f82f08d (patch) | |
tree | beff152a4e348a5842ee973d0080af48062df3d4 | |
parent | 33f07202ce2d9d34f346e9629dc602d920091cf1 (diff) | |
download | sqlalchemy-f9492ef90641c2fa55bcd1ecc93ddcef7f82f08d.tar.gz |
docs
-rw-r--r-- | doc/build/builder/autodoc_mods.py | 7 | ||||
-rw-r--r-- | doc/build/core/constraints.rst | 14 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 30 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/base.py | 13 |
4 files changed, 45 insertions, 19 deletions
diff --git a/doc/build/builder/autodoc_mods.py b/doc/build/builder/autodoc_mods.py index 8e13d76af..5a6e991bd 100644 --- a/doc/build/builder/autodoc_mods.py +++ b/doc/build/builder/autodoc_mods.py @@ -23,13 +23,14 @@ _convert_modname = { _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 diff --git a/doc/build/core/constraints.rst b/doc/build/core/constraints.rst index 91f794de1..3979631b0 100644 --- a/doc/build/core/constraints.rst +++ b/doc/build/core/constraints.rst @@ -431,26 +431,33 @@ name as follows:: 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: @@ -569,3 +576,4 @@ Index API .. autoclass:: Index :members: + :inherited-members: diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index ed975b8cf..0fd41105c 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -115,8 +115,7 @@ class DefaultDialect(interfaces.Dialect): """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, { @@ -127,14 +126,25 @@ class DefaultDialect(interfaces.Dialect): ] 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` + """ diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index 26007b598..818a07deb 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -138,7 +138,14 @@ class _DialectArgDict(_DialectArgDictBase): 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` """ @@ -153,7 +160,7 @@ class DialectKWArgs(object): 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. @@ -164,7 +171,7 @@ class DialectKWArgs(object): :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 |