CData Python Connector for Apache Impala

Build 21.0.7930

Batch Processing

This python connector is also able to perform batch processing to write to the data source. This can be done by using the executemany() method of the cursor object. In addition to a SQL statement string, a data frame of values should be provided as a series of parameters to execute the SQL statement with. as with normal write operations, the statements are executed immediately by the provider. Do not call the connection's commit() method following the execution.

Insert

The following example adds new records to the table:

cur = conn.cursor()
cmd = "INSERT INTO [CData].[Default].Customers (City, CompanyName) VALUES (?, ?)"
params = [["Jon Deere", "RSSBus Inc."], ["Jon Deere", "RSSBus Inc."]]
cur.executemany(cmd, params)
print("Records affected: ", cur.rowcount)

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7930