diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-07-22 13:45:29 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-07-22 13:45:29 +0000 |
| commit | cfb9bbde7da6fe2b145a49851dc2d6424941ef25 (patch) | |
| tree | 358328c45deef934213160e9ada6edb3fa793e3d /test | |
| parent | 59b25a513a0c0fa934a66c80963221bec4c90e8b (diff) | |
| download | sqlalchemy-cfb9bbde7da6fe2b145a49851dc2d6424941ef25.tar.gz | |
allow SQLA-defaults on table columns that are excluded in the mapper
Diffstat (limited to 'test')
| -rw-r--r-- | test/orm/defaults.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/orm/defaults.py b/test/orm/defaults.py index 9f1ecda10..844a81bc4 100644 --- a/test/orm/defaults.py +++ b/test/orm/defaults.py @@ -98,6 +98,24 @@ class TriggerDefaultsTest(_base.MappedTest): eq_(d1.col3, 'up') eq_(d1.col4, 'up') - +class ExcludedDefaultsTest(_base.MappedTest): + def define_tables(self, metadata): + dt = Table('dt', metadata, + Column('id', Integer, primary_key=True), + Column('col1', String(20), default="hello"), + ) + + @testing.resolve_artifact_names + def test_exclude(self): + class Foo(_base.ComparableEntity): + pass + mapper(Foo, dt, exclude_properties=('col1',)) + + f1 = Foo() + sess = create_session() + sess.add(f1) + sess.flush() + eq_(dt.select().execute().fetchall(), [(1, "hello")]) + if __name__ == "__main__": testenv.main() |
