]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
docs(cookbook): add note on including info object on declarative tables (#1051)
authorJack Michaud <jack-michaud@users.noreply.github.com>
Tue, 7 Jun 2022 18:38:04 +0000 (11:38 -0700)
committerGitHub <noreply@github.com>
Tue, 7 Jun 2022 18:38:04 +0000 (20:38 +0200)
docs/build/cookbook.rst

index 23202ea97aa9ea8bd05859a231b4906e3f92ce99..e2b923332b093ddf9636f80b62b3c365e7680b22 100644 (file)
@@ -1150,6 +1150,12 @@ causes Alembic to treat them as tables in need of creation and to generate spuri
 
     my_view = Table('my_view', metadata, autoload=True, info=dict(is_view=True))    # Flag this as a view
 
+Or, if you use declarative tables::
+
+    class MyView(Base):
+        __tablename__ = 'my_view'
+        __table_args__ = {'info': {'is_view': True}} # Flag this as a view
+
 Then define ``include_object`` as::
 
     def include_object(object, name, type_, reflected, compare_to):