Skip to content

Commit 1d877e8

Browse files
committed
Documentation updates- remove new mixins from ref, add some comments
1 parent 6d7a7e3 commit 1d877e8

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

docs/api.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ Metaclass mixins (SQLAlchemy 1.x)
3636
---------------------------------
3737

3838
If your code uses the SQLAlchemy 1.x API (the default for code that doesn't specify a ``model_class``),
39-
then these mixins are automatically applied to the ``Model`` class. They can also be used
40-
directly to create custom metaclasses. See :doc:`customizing` for more information.
39+
then these mixins are automatically applied to the ``Model`` class.
4140

4241
.. autoclass:: DefaultMeta
4342

@@ -46,18 +45,6 @@ directly to create custom metaclasses. See :doc:`customizing` for more informati
4645
.. autoclass:: NameMetaMixin
4746

4847

49-
Base class mixins (SQLAlchemy 2.x)
50-
----------------------------------
51-
52-
If your code uses the SQLAlchemy 2.x API by passing a subclass of ``DeclarativeBase``
53-
or ``DeclarativeBaseNoMeta`` as the ``model_class``, then the following classes
54-
are automatically added as additional base classes.
55-
56-
.. autoclass:: BindMixin
57-
58-
.. autoclass:: NameMixin
59-
60-
6148
Session
6249
-------
6350

src/flask_sqlalchemy/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,11 @@ def should_set_tablename(cls: type) -> bool:
300300
base is cls
301301
or base.__dict__.get("__abstract__", False)
302302
or not (
303+
# SQLAlchemy 1.x
303304
isinstance(base, sa_orm.DeclarativeMeta)
305+
# 2.x: DeclarativeBas uses this as metaclass
304306
or isinstance(base, sa_orm.decl_api.DeclarativeAttributeIntercept)
307+
# 2.x: DeclarativeBaseNoMeta doesn't use a metaclass
305308
or issubclass(base, sa_orm.DeclarativeBaseNoMeta)
306309
)
307310
)

0 commit comments

Comments
 (0)