new

Stack Overflow for Teams

A private, secure home for your team's questions and answers.

Learn more
0
votes
1answer
11 views

Ignore encoding errors with csv writer and MySQLdb

I've been trying to get a full data from a MySQL table to csv with python and I've done it well but now that table has a column "description" and it's a piece of hell now coz there're encoding issues ...
0
votes
2answers
44 views

ERROR: Not enough arguments for format string

My CSV file contains data like this: Date,portfolioValue,pID,FinancialInstrument 2018-03-27,4937.395022140785,1,Oil 2018-03-28,4937.395022140785,1,Oil My insert execution code is as follows: file = ...
0
votes
2answers
20 views

Python MySQLdb - Export query to csv without line terminators

So basically im using MySQLdb query dialy images of my tables and i want to save them in .csv but one of the fields has line terminators (\n) and i cant figure out how to get rid of them so my csv ...
0
votes
2answers
136 views

ValueError: time data '{0}' does not match format '%d/%m/%Y'

I'm trying to INSERT to MySQL from a CSV file, first 'column' in the file is a date in this format: 31/08/2017; then my column in the table is set as YYYY-MM-DD this is my code: import ...
2
votes
1answer
79 views

pandas creating a dataframe from mysql database

So I have been trying to create a dataframe from a mysql database using pandas and python but I have encountered an issue which I need help on. The issue is when writing the dataframe to excel, it ...
0
votes
1answer
25 views

Data not getting inserted in mysql by python

I have used the same code in ubuntu and it worked fine but when i tried to run it in windows it gave me a "()" output.What can be the reason .I am new to this field to i need assistance.` import csv ...
0
votes
1answer
26 views

Python “commands out of sync” error message when I am trying to import csv to MYSQLdb

I've get this error message when i want to execute my sqldb code in Python 2.7: Traceback (most recent call last): File "C:/Python27/air18-mysql.py", line 52, in <module> cursor.execute(...
0
votes
0answers
39 views

How to write csv to mysqldb without error in Python?

I have got a csv file, which one i want to write into a MYSQLdb with Python 2.7. I already did this with another csv file, and it worked correctly, but here i get an error message about the query....
2
votes
1answer
3k views

Pandas Insert data into MySQL

I am trying to insert columns of data that I extracted from .csv file into MySQL using Pandas (Python). Here is my code that I have so far. import pandas as pd from pandas.io import sql from ...
0
votes
0answers
8 views

How to export a csv into MYSQLdb in this format?

I have got a csv file like in this format: "Monday, Jul 24" "8:40 apple 1 " "school" "ball " "dog" "8:45 poirot 2 " "rouge" "chien " "chat" "8:55 football 3" "asroma" "juventus " "...
1
vote
0answers
58 views

How to create a table and after upload data with python 2.7?

I have a csv file, what i want to write into a mysql database. (python2.7) In this csv file there are 6 columns, and a lot of row. There isn't any primary key in this table, so i want to use an ...
1
vote
1answer
18 views

CSV to Mysql with Python 2.7 on windows7

I get this error, when im trying to run my code : "Traceback (most recent call last): File "C:/Python27/mysql2.py", line 7, in <module> cursor.execute(query2) File "C:\Python27\...
0
votes
2answers
425 views

_mysql_exceptions.OperationalError: (1366, “Incorrect integer value: '%s' for column 'ID' at row 1”)

I am trying to insert my data from .csv to Mysql database using python script. python script which i used import csv import MySQLdb db = MySQLdb.connect(host='localhost',user='root',passwd='...
0
votes
1answer
139 views

Python MySQL Bulk Insertion Error with Character Encode

I Start new Project in Python with MySQL. I just try to insert millions of record from CSV to MySQL through MySQLdb package. My Code: import pandas as pd import MySQLdb #Connect with MySQL ...
2
votes
2answers
867 views

how to create a SQL database from a csv file in Python

I need to load in a large dataset (20gb for now but will be 100 gb in the future) from a csv file. I am using the MySQLdb module in python (PyCharm). I also need to only select some certain columns. ...
1
vote
1answer
2k views

Using MysqlDb in python converts null to None

Below is my code import MysqlDB as mob Mysqlconn = mdb.connect(hostname, username, password, databasename,port=3306,cursorclass=mdb.cursors.DictCursor) Mysqlcur = self.Mysqlcon.cursor() Mysqlcur....
1
vote
1answer
75 views

Error loading log file data into mysql using cvs format and python

I am trying to take a data from a log file in cvs format, open the log file and inserting row by row into mysql. I am getting an error like this: ERROR Traceback (most recent call last): File "/...
0
votes
1answer
243 views

Python Cursor to Csv using csv.writer.writerows

I'm currently trying to write the results of a MySQL select statement to a csv. I'm using MySQLdb to select data, which returns a cursor. I'm then passing that cursor into a function that writes it ...
0
votes
1answer
133 views

Run MySQL to load CSV to MySQL in Python 2.7 -

I am trying to upload a csv table into a MySQl table using MySQLdb module in python 2.7. import MySQLdb connection = MySQLdb.connect(host="localhost", user="root", passwd="password", db="test") ...
0
votes
2answers
443 views

Python MySQL query to CSV in memory

I have a Python script which queries a DB and then emails the result. At the moment the script looks like this (please excuse my inexperience with Python) db = mdb.connect(db_host, db_user, db_pass, ...
5
votes
1answer
634 views

Python MySQLdb SScursor slow in comparison to exporting and importing from CSV-file. Speedup possible?

As part of building a Data Warehouse, I have to query a source database table for about 75M rows. What I want to do with the 75M rows is some processing and then adding the result into another ...
0
votes
1answer
2k views

Import Specific Column Data into Different MYSQL Tables from CSV using Python

I have a csv file with many columns and I want to import two to one table, ten to another, and ten to another still. How could I modify the code below to be selective like that? I was thinking of ...
1
vote
1answer
844 views

Issue getting csv data into mysql table with python and mysqldb

I've been fighting with this python code for a while and getting various errors when I try to execute. import csv import MySQLdb # open the connection to the MySQL server. # using MySQLdb mydb = ...
0
votes
0answers
252 views

Why do I get these errors “Data truncated for column”?

I use this string to upload my CSV file into a MySQL table. Query = """ LOAD DATA LOCAL INFILE 'Data to file_name.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'...
0
votes
1answer
417 views

SQL query embedded in python script - ERROR

I wanted a script that iterates through csv files in a folder and dump them into a MySQL database. I was able to dump one csv file into it.. But have troubles passing the file name in to the SQL ...
1
vote
1answer
2k views

Insert a lot of products opencart script

I have a script in python in which I have all my products, descriptions , images, etc. Now I want to insert all this information in my Opencart theme. I try to find out how to save it all of this in ...