From: Eloy Felix Date: Tue, 20 Jun 2017 13:29:34 +0000 (-0400) Subject: Don't erase reflected comment in _init_existing X-Git-Tag: rel_1_2_0b1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bff001187f5ad7192103d6255158a6c88e848049;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Don't erase reflected comment in _init_existing Change-Id: Ie0b78c79367933486528ca0ba686d4a9f16922b1 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/370 --- diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 4eb095196c..3ba36e714d 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -593,11 +593,12 @@ class Table(DialectKWArgs, SchemaItem, TableClause): raise exc.ArgumentError( "Can't redefine 'quote' or 'quote_schema' arguments") + if 'comment' in kwargs: + self.comment = kwargs.pop('comment', None) + if 'info' in kwargs: self.info = kwargs.pop('info') - self.comment = kwargs.pop('comment', None) - if autoload: if not autoload_replace: # don't replace columns already present. diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index 80a8047965..a6b0cdec9c 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -1055,6 +1055,10 @@ class ReflectionTest(fixtures.TestBase, ComparesTables): eq_(t2.comment, 't1 comment') eq_(t2.c.id.comment, 'c1 comment') + t3 = Table('sometable', m2, extend_existing=True) + eq_(t3.comment, 't1 comment') + eq_(t3.c.id.comment, 'c1 comment') + @testing.requires.check_constraint_reflection @testing.provide_metadata def test_check_constraint_reflection(self):