From: Jack Michaud Date: Tue, 7 Jun 2022 18:38:04 +0000 (-0700) Subject: docs(cookbook): add note on including info object on declarative tables (#1051) X-Git-Tag: rel_1_8_1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd91da9732fc14d1566e7df562c18ebbc54a2d6f;p=thirdparty%2Fsqlalchemy%2Falembic.git docs(cookbook): add note on including info object on declarative tables (#1051) --- diff --git a/docs/build/cookbook.rst b/docs/build/cookbook.rst index 23202ea9..e2b92333 100644 --- a/docs/build/cookbook.rst +++ b/docs/build/cookbook.rst @@ -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):