A method to prepare a database query or command and execute it against all parameters found in a sequence or mapping of parameters.
Questions tagged [executemany]
135 questions
0
votes
1 answer
SQLite executemany asking for more values than expected
I'm trying to insert a list into a database with SQLite, the first value is an id with AUTOINCREMENT property. This is the code:
# cursor.execute('''
# CREATE TABLE products (
# prod_id INTEGER PRIMARY KEY AUTOINCREMENT,
# prod_name…

jotaro-gogogo
- 59
- 1
- 8
0
votes
2 answers
Python: Bulk upload records of Oracle table with executemany() in python
data=[]
dataToInsert = [ ]
for index, row in df.iterrows():
contentid = row['CONTENTID']
Objectsummary = row['OBJECT_SUMMARY']
Title=row['TITLE']
if Title is None:
Title = ""
if Objectsummary is None:
Objectsummary = ""
…

Dimple
- 51
- 6
0
votes
2 answers
having syntax error trying to use on duplicate
sql_insert_query = "insert into TABLE1 (building, course, description, course_type, course_type_desc, dual_credit)
VALUES (?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE building = VALUES(building), course = VALUES(course), description =…

Mike Lim
- 1
- 3
0
votes
2 answers
Speeding up insert into temp table in Sybase using sqlalchemy
I am getting extremely poor performance when inserting into sybase temp table - in the order of 10's of seconds for only 1000 rows. It takes 46 seconds for 1000 rows and 10000 rows takes multiple minutes. I will have about 100k rows.
Is there any…

Krish Srinivasan
- 568
- 1
- 6
- 14
0
votes
0 answers
Python3 ODBC Execute Many
I am trying to copy data from 1 oracle table to another in a different schema using the python odbc library. Here is what I'm doing
source = SomeString (source Oracle DataTable)
target = SomeString (target Oracle DataTable)
Connecting to data source…

Nabeel
- 1
0
votes
1 answer
Incorrect number of bindings in Python Sqlite3 executemany
So I have an sqlite3 database in Python where is a table to which I am trying to add 1000 strings. The problem is, when I use executemany command I get an error
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement…

nh3
- 45
- 5
0
votes
1 answer
Exception: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N unexpected token Error
I have the following data frame
CALL_DISPOSITION CITY END INCIDENT_NUMBER
0 ADV-Advised Waterloo Fri, 23 Mar 2018 01:13:27 GMT 6478983
1 AST-Assist Waterloo Sat,…

kryogenic1
- 166
- 1
- 2
- 15
0
votes
0 answers
Is possible to use pyodbc executemany to update multiple rows in a SQL Table?
I have used pyodbc.executemany to insert items in database tables. I am trying to update multiple rows using pyodbc.executemany and I keep getting errors. Is it possible to use pyodbc.executemany for updating multiple rows?
Here is my code:
import…

Vik
- 137
- 1
- 8
0
votes
2 answers
Too many server roundtrips w/ psycopg2
I am making a script, that should create a schema for each customer. I’m fetching all metadata from a database that defines how each customer’s schema should look like, and then create it. Everything is well defined, the types, names of tables, etc.…

GoldenRetriever
- 155
- 3
- 11
0
votes
2 answers
How to use Executemany in my situation?
How can I get these sequence of SQL statements? to work? I have previously only dealt with single select statements and cursor.execute worked fine for that. I'm not sure what to do in this case now. The error I am getting is format requires a…

super9
- 29,181
- 39
- 119
- 172
0
votes
0 answers
Python MySQLCannot Update With Dataset Containing 25k Records
Important Details:
mysql-connector-python==8.0.18
I am using pypy3, which works as an alternate implementation of Python3
Each item in the bulk_data list is a dict object with two items, each key is less than 10 characters and each value is no more…

JWinkler05
- 26
- 5
0
votes
0 answers
Executemany throws "Invalid number of parameters (expected 12, got 71625)" on INSERT into a SQL Server table
I read into a dataframe from an Excel file of 71k rows (via pandas.read_excel()) and then want to insert it into a database on a local SQL Server via turbodbc.
Code:
query = 'INSERT INTO сonnTable (ID, SiteRootID, ElementID, ElementType, Username,…

evictorov
- 33
- 1
- 12
0
votes
0 answers
Python/MySql good with cursor.execute but not cursor.executemany . 'TypeError: not all arguments converted during string formatting'
I have a function that does a mysql inport of a csv file. It was importing line by line but I wanted to speed it up and create a larger mysql insert using cussor.executemany. In the first version of code, which I used for 6 months, it would loop…

personalt
- 810
- 3
- 13
- 26
0
votes
1 answer
PostgreSQL Update From Values Treats Nulls As Text
Need help in solving an issue when one of the values' columns contains only Null values. Example:
create table foo (
id serial constraint foo_pk primary key,
a int,
b int
);
insert into foo (a,b) values (1, 1), (2, 2);
update foo t
set…

Dmitry
- 2,626
- 2
- 10
- 15
0
votes
2 answers
Step through CSV file incrementally in Python
I am trying to speed up loading a large CSV file into a MySQL database. Using this code it takes about 4 hours to load a 4GB file:
with open(source) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
next(csv_reader)
…

bluethundr
- 1,005
- 17
- 68
- 141