Questions tagged [executemany]

A method to prepare a database query or command and execute it against all parameters found in a sequence or mapping of parameters.

135 questions
0
votes
1 answer

How to use cur.executemany() to store data from Twitter

I am trying to download tweets from a list of three different accounts and then store all the informations in a SQL3 database. I have tried with the code below, but it seems to run forever. Am I missing something? Is this because I used…
0
votes
1 answer

python is crashed while using fast_executemany as TRUE with Sql Server

I am trying to import data from SourceDB to TargetDB. There are only 15000 rows in the respective table and taking approx 20 min with fast_executemany as False but when I set fast_executemany as true my python interpreter crashed at…
Amit Singh
  • 63
  • 2
  • 12
0
votes
1 answer

Python's MySQLdb changes double quotes to single quotes

I'm using python to read values from REST API and write to a MySQL table. One of the returned values is a JSON, which I want to store in the DB. The value returned by the API has escaped quotes and looks something like: {\"dashboard\":\"val\"} When…
Aamit
  • 181
  • 4
  • 16
0
votes
2 answers

Python 3.6 - What does "string % tuple" do?

I am writing a python module for an Django-based application that accesses an Oracle database via cx_Oracle. It "appears" that the django code has a bug that breaks the use of the cx_Oracle "executemany" method. If I use cx_Oracle with a…
0
votes
1 answer

sqlite3.OperationalError: near "%": syntax error

I created the following table: sql_command = """CREATE TABLE users ( id VARCHAR(255) PRIMARY KEY, name VARCHAR(255), company VARCHAR(255));""" When I run the following: sql = """INSERT INTO users(id, name, company) VALUES (%s, %s,…
0
votes
1 answer

How do I use executemany to write the first values in each Key to a database

I am new to Python and am trying to use a for loop to add the first and subsequent values, sequentially from a list within a dictionary to a database by using the cursor.executemany() function. here is my code, dict = {'yo':…
0
votes
1 answer

cx_Oracle.NotSupportedError: Python value cannot be converted to a database value

I am trying read data from one table and write into another table in another database using Python and cx_Oracle. My script works fine when I read the records one by one but when I fetch more than 100 records using fetchmany, the script fails with…
0
votes
1 answer

Executemany SELECT queries with psycopg2

I have a large postgresql DB of users that I connect with using psycopg2. I need to retrieve (SELECT) the information of a specific large subset of users (>200). I am provided with a list of ids and I need to return the age of each of those users. I…
Titus Pullo
  • 3,751
  • 15
  • 45
  • 65
0
votes
1 answer

Values are not inserted into MySQL table using pool.apply_async in python2.7

I am trying to run the following code to populate a table in parallel for a certain application. First the following function is defined which is supposed to connect to my db and execute the sql command with the values given (to insert into…
0
votes
1 answer

Inserting into MySQL using MySQLdb - python

https://drive.google.com/open?id=1aQkJYojDNMjNjJYlggxbkTq-KmzALDDb I have this file (citations.dmp) and im tryin' to insert the data separed by | into a mysql database using the following code: import MySQLdb file = open('citations.dmp',…
user9016056
0
votes
0 answers

Python + SQLite executemany: empty iterator after exception

SO virgin and SQLite newbie here, I'm using python 2.7.9. I would like to use database constraints and executemany method to insert data to my database. While creating tests I noticed that if constraint is applied my import fails with executemany…
melli
  • 1
  • 1
  • 1
0
votes
2 answers

pymsql + not enough arguments for format string + by a list

I am facing the error message TypeError: not enough arguments for format string Here is my code for data in zip(link_hash, link, headline, snippit, rubID, date, time): pass if not sql_one_empty: sql_insert_hash = """ INSERT INTO ntv…
0
votes
1 answer

Syntax error with parameterized queries after switching from pyodbc to pymssql

I have 13-15MB raw files to load its data into DB, and it takes around 50-55mins to insert around 30k-35k rows using executemany with pyodbc and it worked fine but its processing time is high. For testing the performance I tried pymssql but it is…
Shivkumar kondi
  • 6,458
  • 9
  • 31
  • 58
0
votes
1 answer

How to insert multiple rows in SQL Server?

I have table with 17 columns and I have to insert rows from a particular file into this table. Number of rows in that file are ~ 4000. I have approached ExecuteMany(qry) method to insert multiple rows, but I have final columns data as: rows =…
user7515543
0
votes
0 answers

get different error when I use executemany command

I write the following code I got the errors when I use executemany. But when I use loop for executing query, it works properly. How Can I fixed this issue. def insertRows(self, query,data): print data[0] try: …
user3487667
  • 519
  • 5
  • 22
1 2 3
8
9