From b51f045ee555ecf5e9e3ee7383d00d5d52ca3f39 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Fri, 8 Feb 2019 19:10:19 +0000 Subject: [PATCH] Add type stubs link to the docs Moved by Mike to be a sidebar in the Declarative docs, as the plugin appears to be specific to Declarative. These docs will eventually be moved out of the "extension" section and merged into the primary narrative documentation. Co-authored-by: Mike Bayer Change-Id: Idba4c13ffc920b1140b5e51d206ab02f19015e8e --- doc/build/core/type_basics.rst | 1 - doc/build/orm/extensions/declarative/basic_use.rst | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/build/core/type_basics.rst b/doc/build/core/type_basics.rst index bf9cad0648..da73047244 100644 --- a/doc/build/core/type_basics.rst +++ b/doc/build/core/type_basics.rst @@ -18,7 +18,6 @@ the database driver returns an incorrect type. ... Column('login', String(32)) ... ) - SQLAlchemy will use the ``Integer`` and ``String(32)`` type information when issuing a ``CREATE TABLE`` statement and will use it again when reading back rows ``SELECTed`` from the database. diff --git a/doc/build/orm/extensions/declarative/basic_use.rst b/doc/build/orm/extensions/declarative/basic_use.rst index 63ab932c15..02f64b0645 100644 --- a/doc/build/orm/extensions/declarative/basic_use.rst +++ b/doc/build/orm/extensions/declarative/basic_use.rst @@ -70,6 +70,15 @@ added to the underlying :class:`.Table` and Classes which are constructed using declarative can interact freely with classes that are mapped explicitly with :func:`.mapper`. + +.. sidebar:: Using MyPy with SQLAlchemy models + + If you are using PEP 484 static type checkers for Python, a `MyPy `_ + plugin is included with + `type stubs for SQLAlchemy `_. The plugin + is tailored towards SQLAlchemy declarative models. + + It is recommended, though not required, that all tables share the same underlying :class:`~sqlalchemy.schema.MetaData` object, so that string-configured :class:`~sqlalchemy.schema.ForeignKey` -- 2.47.2