]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Don't erase reflected comment in _init_existing
authorEloy Felix <eloyfelix@gmail.com>
Tue, 20 Jun 2017 13:29:34 +0000 (09:29 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 Jun 2017 13:48:49 +0000 (09:48 -0400)
Change-Id: Ie0b78c79367933486528ca0ba686d4a9f16922b1
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/370

lib/sqlalchemy/sql/schema.py
test/engine/test_reflection.py

index 4eb095196c7ca4acbe0082988d289053611956ac..3ba36e714de923465d7f7b39f0f719fa79136e26 100644 (file)
@@ -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.
index 80a80479653b6915043c1574442210d081082d88..a6b0cdec9c00d7d7c37d375c0d6fd31ae671ffe5 100644 (file)
@@ -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):