summaryrefslogtreecommitdiff
path: root/test/orm/declarative/test_basic.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2023-04-12 21:21:36 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2023-04-12 21:21:36 +0000
commit53be3fc70a44d34fda1ffddcf9d67473d3de50b4 (patch)
treefbadb6bb7d078ad6041224270f11973232952b24 /test/orm/declarative/test_basic.py
parent107ec58bdfbcbb09f40d92590f8197ffa683a925 (diff)
parent9f43b10e9014e694cb89fe2899dc52f602bf2197 (diff)
downloadsqlalchemy-53be3fc70a44d34fda1ffddcf9d67473d3de50b4.tar.gz
Merge "establish column_property and query_expression as readonly from a dc perspective" into main
Diffstat (limited to 'test/orm/declarative/test_basic.py')
-rw-r--r--test/orm/declarative/test_basic.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/orm/declarative/test_basic.py b/test/orm/declarative/test_basic.py
index 2d712c823..698b66db1 100644
--- a/test/orm/declarative/test_basic.py
+++ b/test/orm/declarative/test_basic.py
@@ -2593,6 +2593,26 @@ class DeclarativeMultiBaseTest(
sess.expunge_all()
eq_(sess.query(User).all(), [User(name="u1", a="a", b="b")])
+ def test_active_history_columns(self):
+ class Foo(Base):
+ __tablename__ = "foo"
+
+ id = Column(
+ Integer, primary_key=True, test_needs_autoincrement=True
+ )
+ a = column_property(Column(String), active_history=True)
+ b = mapped_column(String, active_history=True)
+ c = column_property(Column(String))
+ d = mapped_column(String)
+
+ self.assert_compile(
+ select(Foo), "SELECT foo.id, foo.a, foo.b, foo.c, foo.d FROM foo"
+ )
+ eq_(Foo.a.impl.active_history, True)
+ eq_(Foo.b.impl.active_history, True)
+ eq_(Foo.c.impl.active_history, False)
+ eq_(Foo.d.impl.active_history, False)
+
def test_column_properties(self):
class Address(Base, fixtures.ComparableEntity):