summaryrefslogtreecommitdiff
path: root/test/sql/test_insert.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-11-12 12:34:01 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-11-12 12:34:01 -0500
commit88ca587eae19afb8e069d896b95580aaed8b0e24 (patch)
tree43b8cdb72e33b201655caecac5b3467609c84dec /test/sql/test_insert.py
parentdd93c6a116ff62040a938d5e63a2f71d6a2f3805 (diff)
downloadsqlalchemy-88ca587eae19afb8e069d896b95580aaed8b0e24.tar.gz
Count columns using PrimaryKeyConstraint.__len__ directly
PrimaryKeyConstraint is present on Table however on table() and others it's a ColumnSet. The warning here only needs len() and PrimaryKeyConstraint supports that directly in the same way as ColumnSet. Change-Id: I19c11a39110bfef48cdea49a471e7ab80b537538 Fixes: #3842
Diffstat (limited to 'test/sql/test_insert.py')
-rw-r--r--test/sql/test_insert.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py
index 79de40e9c..2fa1860de 100644
--- a/test/sql/test_insert.py
+++ b/test/sql/test_insert.py
@@ -598,6 +598,23 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
dialect=d
)
+ def test_anticipate_no_pk_lower_case_table(self):
+ t = table(
+ 't',
+ Column(
+ 'id', Integer, primary_key=True, autoincrement=False),
+ Column('notpk', String(10), nullable=True)
+ )
+ with expect_warnings(
+ "Column 't.id' is marked as a member.*"
+ "may not store NULL.$"
+ ):
+ self.assert_compile(
+ t.insert(),
+ "INSERT INTO t () VALUES ()",
+ params={}
+ )
+
class InsertImplicitReturningTest(
_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):