From 9df4651fba6d1cd3d2b490f58263cc45a81788f4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 8 Oct 2013 19:47:13 -0400 Subject: Fixed bug where using an annotation such as :func:`.remote` or :func:`.foreign` on a :class:`.Column` before association with a parent :class:`.Table` could produce issues related to the parent table not rendering within joins, due to the inherent copy operation performed by an annotation. [ticket:2813] --- test/sql/test_selectable.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/sql') diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index df174fb25..87a226782 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -10,6 +10,7 @@ from sqlalchemy.sql import util as sql_util, visitors, expression from sqlalchemy import exc from sqlalchemy.sql import table, column, null from sqlalchemy import util +from sqlalchemy.schema import Column, Table, MetaData metadata = MetaData() table1 = Table('table1', metadata, @@ -1460,6 +1461,12 @@ class AnnotationsTest(fixtures.TestBase): c1.name = 'somename' eq_(c1_a.name, 'somename') + def test_late_table_add(self): + c1 = Column("foo", Integer) + c1_a = c1._annotate({"foo": "bar"}) + t = Table('t', MetaData(), c1) + is_(c1_a.table, t) + def test_custom_constructions(self): from sqlalchemy.schema import Column class MyColumn(Column): -- cgit v1.2.1