ODBC Driver for eBay

Build 20.0.7587

Parameterized Statements

The following code example shows how to bind parameters to create parameterized statements.

Single-Use Statements

The execute method accepts an additional sequence for binding query parameters to values.

cursor.execute("SELECT HitCount, Title FROM ItemListing WHERE AdminEndedItemsOnly = ?", ("true",))
for (HitCount, Title) in cursor:
    print("HitCount = {}, Title = {}".format(HitCount, Title))

Multi-Use Statements

The executemany method can be used to execute the same query repeatedly with different sets of parameters. Instead of a sequence of parameters, executemany accepts a nested sequence of parameters which are used for each execution.

executemany works only with INSERT, UPDATE and DELETE statements. It cannot be used with any operation that returns results, such as a SELECT or an EXECUTE.

params = [
  ("My Awesome Book II 1",),
  ("My Awesome Book II 2",),
  ("My Awesome Book II 3",),

cursor.executemany("INSERT INTO ItemListing(Title) VALUES (?)", params)

Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 20.0.7587