Commits

Mike Bayer committed 369e2cd

- [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]

Comments (0)

Files changed (3)

     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

lib/sqlalchemy/sql/compiler.py

                 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))
                 )

test/sql/test_compiler.py

         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,
         )
 
         assert_raises_message(
-            exc.SAWarning,
+            exc.CompileError,
             "Unconsumed column names: j",
             t.update().values(x=5, j=7).compile,
             column_keys=['j']