]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- [feature] The "unconsumed column names" warning emitted
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Apr 2012 20:27:58 +0000 (16:27 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Apr 2012 20:27:58 +0000 (16:27 -0400)
when keys are present in insert.values() or update.values()
that aren't in the target table is now an exception.
[ticket:2415]

CHANGES
lib/sqlalchemy/sql/compiler.py
test/sql/test_compiler.py

diff --git a/CHANGES b/CHANGES
index 95ae66802c9814e8b2c391ea63abf2dcc3339b5f..113d54db65de99b46d9e3ac55956f543ea3dbbb8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -176,6 +176,11 @@ CHANGES
     by setting "case_insensitive=False" on 
     create_engine().  [ticket:2423]
 
+  - [feature] The "unconsumed column names" warning emitted
+    when keys are present in insert.values() or update.values()
+    that aren't in the target table is now an exception.
+    [ticket:2415]
+
   - [bug] All of UniqueConstraint, ForeignKeyConstraint,
     CheckConstraint, and PrimaryKeyConstraint will
     attach themselves to their parent table automatically
index 218e48bcaec59d6a0131af1188d5d11ba6cdab93..a58da176cd5e80f9e887043944749b3a5c8f9c0f 100644 (file)
@@ -1411,7 +1411,7 @@ class SQLCompiler(engine.Compiled):
                 sql._column_as_key(k) for k in stmt.parameters
             ).difference(check_columns)
             if check:
-                util.warn(
+                raise exc.CompileError(
                     "Unconsumed column names: %s" % 
                     (", ".join(check))
                 )
index d5d5eaa2d0d035c87a9c265e14d715ac596d5e2b..dfdf8bd873196e8b1b58b6220fe3555a9396b1f4 100644 (file)
@@ -3020,18 +3020,18 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
         t = table("t", column("x"), column("y"))
         t2 = table("t2", column("q"), column("z"))
         assert_raises_message(
-            exc.SAWarning,
+            exc.CompileError,
             "Unconsumed column names: z",
             t.insert().values(x=5, z=5).compile,
         )
         assert_raises_message(
-            exc.SAWarning,
+            exc.CompileError,
             "Unconsumed column names: z",
             t.update().values(x=5, z=5).compile,
         )
 
         assert_raises_message(
-            exc.SAWarning,
+            exc.CompileError,
             "Unconsumed column names: j",
             t.update().values(x=5, j=7).values({t2.c.z:5}).
                 where(t.c.x==t2.c.q).compile,
@@ -3053,7 +3053,7 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         assert_raises_message(
-            exc.SAWarning,
+            exc.CompileError,
             "Unconsumed column names: j",
             t.update().values(x=5, j=7).compile,
             column_keys=['j']