@@ -479,6 +479,21 @@ 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 , 'insert statement should be multivalues'
494
+ else :
495
+ assert statement .parameters is None , 'insert statement should not be multivalues'
496
+
482
497
483
498
# -----------------------------------------------------------------------------
484
499
# -- Testing the public API
@@ -1665,6 +1680,9 @@ class Temporary(Base):
1665
1680
1666
1681
tm .assert_frame_equal (df , expected )
1667
1682
1683
+ def test_insert_multivalues (self ):
1684
+ self ._test_insert_multivalues ()
1685
+
1668
1686
1669
1687
class _TestSQLAlchemyConn (_EngineToConnMixin , _TestSQLAlchemy ):
1670
1688
0 commit comments