summaryrefslogtreecommitdiff
path: root/doc/build/orm
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2023-01-09 21:45:11 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2023-01-13 10:40:19 -0500
commitb04b7527ed1df22d32707acda9a3c1fea04ca5a8 (patch)
treec7c4391ddcfc6425d6cc70708c51d9b2e682dc86 /doc/build/orm
parenta2bdc052abfa68e0e5465649db6584769eafd8ce (diff)
downloadsqlalchemy-b04b7527ed1df22d32707acda9a3c1fea04ca5a8.tar.gz
Make the custom type map more discoverable
Change-Id: Id6cdaddad83aa93508e256e54010a6c53218b717
Diffstat (limited to 'doc/build/orm')
-rw-r--r--doc/build/orm/declarative_tables.rst12
-rw-r--r--doc/build/orm/quickstart.rst4
2 files changed, 8 insertions, 8 deletions
diff --git a/doc/build/orm/declarative_tables.rst b/doc/build/orm/declarative_tables.rst
index 882d504eb..a45fdfd8e 100644
--- a/doc/build/orm/declarative_tables.rst
+++ b/doc/build/orm/declarative_tables.rst
@@ -322,13 +322,11 @@ the registry and Declarative base could be configured as::
class Base(DeclarativeBase):
- registry = registry(
- type_annotation_map={
- int: BIGINT,
- datetime.datetime: TIMESTAMP(timezone=True),
- str: String().with_variant(NVARCHAR, "mssql"),
- }
- )
+ type_annotation_map = {
+ int: BIGINT,
+ datetime.datetime: TIMESTAMP(timezone=True),
+ str: String().with_variant(NVARCHAR, "mssql"),
+ }
class SomeClass(Base):
diff --git a/doc/build/orm/quickstart.rst b/doc/build/orm/quickstart.rst
index a22ad2ffd..a4531e8d3 100644
--- a/doc/build/orm/quickstart.rst
+++ b/doc/build/orm/quickstart.rst
@@ -82,7 +82,9 @@ that's associated with each :class:`_orm.Mapped` annotation; ``int`` for
not the ``Optional[]`` type modifier is used. More specific typing information
may be indicated using SQLAlchemy type objects in the right side
:func:`_orm.mapped_column` directive, such as the :class:`.String` datatype
-used above in the ``User.name`` column.
+used above in the ``User.name`` column. The association between Python types
+and SQL types can be customized using the
+:ref:`type annotation map <orm_declarative_mapped_column_type_map>`.
The :func:`_orm.mapped_column` directive is used for all column-based
attributes that require more specific customization. Besides typing