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
2 answers
Executemany confusion
Ok, so I have a function that selects certain rows in a sqlite database based on input from a plugin. I got the plugin to select and fetch rows when just one statement is involved, but since I want to add some flexibility to this, I tried making the…

Varriount
- 663
- 5
- 18
0
votes
1 answer
Python sqlite3 'executemany' not successfully updating my database
I'm trying to extract a column from my database, apply a transformation, and create a new column with the results.
I ultimately want to save the local variable 'new_proba' (which has a length of 740, the same length as my database) as a new column…

BernoulliSanders
- 23
- 4
0
votes
1 answer
Python mysql.connector update error code 1064
I am trying to insert an array of ints. I use the exact same code serval lines above to update "processed = 1" from 0. The code looks like this:
cursor.executemany('''UPDATE %s SET flag = "bad" WHERE id = %%s''' % seed_table, (bad_list))
The error…

six7zero9
- 313
- 1
- 4
- 15
0
votes
1 answer
python sqlite3 executemany using multiple lists
Background:
So I have a large array that I am reading from one source and trying to write (efficiently) into SQLite3 using python.
Currently I use the default form:
cursor.executemany("INSERT into mytable1 VALUES(?,?,?)", my_arr.tolist())
Now I…

EngrStudent
- 1,924
- 31
- 46
0
votes
1 answer
Python3 | sqlite3: executemany() inserts nothing
I am trying to use sqlite3's executemany() to insert multiple values with Python3.
Code:
import sqlite3
conn = sqlite3.connect('rssnewsdata.db')
c = conn.cursor()
entries = [
('url1', 1234, 'title1', 'summary1', 'feedurl1'),
('url2', 1235,…

imrek
- 2,930
- 3
- 20
- 36
0
votes
1 answer
Python executemany function
I have a problem when running executemany with cx_oracle
WHen I run the following statement, I receive ORA-01036: illeagal variablename/number
infotext_list is a list of strings that should be compared with the "SOMETHING"
it looks like ["abc",…

goldjunge
- 3
- 3
0
votes
0 answers
python sqlite3 select multiple rows with duplicates
I am wanting to perform random samples from a large database, and I am wanting those samples to be paired, which means that I either I care about the order of results from a (series of) select statement(s) or reorder afterwards. Additionally, there…

pandamonium
- 109
- 7
0
votes
3 answers
Insert CSV data into django model using executemany
I have a csv file which have around 900000 rows with 13 columns, everything works fine till 28445 rows but after that it gives error
ProgrammingError
Exception Value: not enough arguments for format string
I tried to check whether there is…

vaibhav1312
- 863
- 4
- 13
- 31
0
votes
1 answer
How to write a executemany with two inputs in haskell?
saveX :: [String] -> Int->IO ()
saveX [] y= return ()
sav xs y=
do conn <- connectSqlite3 "cw.db"
stmt <- prepare conn "INSERT INTO pic (src,urlId) VALUES (?,?)"
executeMany stmt
commit conn
I have a…

Gihan
- 2,476
- 2
- 27
- 33
0
votes
1 answer
Does MySQLdb Cursors not support empty iterator?
cur.executemany(sql, rows)
I have rows as empty iterator, it triggers an error.
If I do cur.executemany(sql, list(rows)) then it works fine.
File "/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/MySQLdb/cursors.py", line 252, in…

colinfang
- 20,909
- 19
- 90
- 173
0
votes
1 answer
python 2.4.3 sqlite executemany syntax
I am stuck using python 2.4.3 and the sqlite module issued with that distribution.
How can i run the executemany command in this environment? The more modern syntax seems to have an issue.
import sqlite as sql
conn = sql.connect('test.db')
c =…

Zero_Loss
- 3
- 3
0
votes
1 answer
How to insert the keys and values of python dict in mysql using python
I have a python dict like this:
my_dict = {'find': ['http://time.com', 'http://find.com'], 'time': ['http://any.com', 'http://www.tim.com', 'http://mine.in']...}
I want to insert keys and values of dictionary my_dict in two different columns of a…

Amit Yadav
- 1,861
- 2
- 20
- 27
-1
votes
1 answer
how to insert multiple rows into sqllite3 database
I am trying to select rows and fetch them from the DB table and then insert them into a list so I can insert all of the rows at once into the database, but I got an error.
def paid_or_returned_buyingchecks(self):
date = datetime.now()
now =…

asaad kittaneh
- 45
- 1
- 7
-1
votes
1 answer
Python SQLite Regex ExecuteMany
Thanks in advance for your help.
I am in python using regex and bucket up the patterns in text. I then stored it in a list, and called upon that list when inserting values into a table using SQLite. However, I am getting a 'str' object has no…

Masooma
- 1
-1
votes
1 answer
MySQL and Python: Auto_Increment Not Working with cursor.executemany()
I created a table as below:
cur.execute("""CREATE TABLE IF NOT EXISTS worddata(
wordid INT(11) AUTO_INCREMENT PRIMARY KEY,
Keyword VARCHAR(100) NOT NULL,
FileName VARCHAR(100));""")
and then executed…

Samiksha Mishra
- 21
- 5