@@ -479,6 +479,25 @@ def _transaction_test(self):
479
479
res2 = self .pandasSQL .read_query ('SELECT * FROM test_trans' )
480
480
assert len (res2 ) == 1
481
481
482
+ def _test_insert_multivalues (self ):
483
+ db = sql .SQLDatabase (self .conn )
484
+ df = DataFrame ({'A' : [1 , 0 , 0 ], 'B' : [1.1 , 0.2 , 4.3 ]})
485
+ table = sql .SQLTable ("test_table" , db , frame = df )
486
+ data = [
487
+ {'A' : 1 , 'B' : 0.46 },
488
+ {'A' : 0 , 'B' : - 2.06 }
489
+ ]
490
+ statement = table .insert_statement (data , conn = self .conn )[0 ]
491
+ dialect = getattr (self .conn , 'dialect' , None )
492
+ if dialect and getattr (dialect , 'supports_multivalues_insert' , False ):
493
+ assert statement .parameters == data , (
494
+ 'insert statement should be multivalues'
495
+ )
496
+ else :
497
+ assert statement .parameters is None , (
498
+ 'insert statement should not be multivalues'
499
+ )
500
+
482
501
483
502
# -----------------------------------------------------------------------------
484
503
# -- Testing the public API
@@ -1665,6 +1684,9 @@ class Temporary(Base):
1665
1684
1666
1685
tm .assert_frame_equal (df , expected )
1667
1686
1687
+ def test_insert_multivalues (self ):
1688
+ self ._test_insert_multivalues ()
1689
+
1668
1690
1669
1691
class _TestSQLAlchemyConn (_EngineToConnMixin , _TestSQLAlchemy ):
1670
1692
0 commit comments