Use this tag for questions about the MySQL-Python database connector library (MySQLdb). Do not use this tag for questions about MySQL Connector/Python (use the [mysql-connector-python] tag instead).

learn more… | top users | synonyms (1)

3
votes
1answer
14 views

ImportError: No module named _mysql

I'm trying to use the Python module MySQL-python to connect to an external MySQL database from an AWS EC2 instance running amazon linux. This is the code I'm trying to run: db=_mysql.connect(host="...
0
votes
0answers
16 views

How do I get values from a form in Python?

I should get values from a form and insert them in a database. So this is my code. When I test via a browser, it does not work. I check in the database and the table but has no values. Kindly note I ...
0
votes
0answers
4 views

Plone 3 - install MySQLdb and ZmySQLDA

Anyone knows how to install/import those library and I already post a thread on plone community but only 1 commented "He says that I should switch to linux" but I need to install it on Windows 7
0
votes
0answers
46 views

MySQL with Django - Python

I'm integrating MySQL as backend with my Django application. At the time of installation i'm running following command (using mac os) export PATH=$PATH:/usr/local/mysql/bin start server from settings ...
0
votes
1answer
24 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 ...
0
votes
1answer
23 views

TypeError: 'connection' object is not callable in python using mysqldb

from flask import Flask from flask_restful import Resource, Api from flask_restful import reqparse from flask_mysqldb import MySQL mysql = MySQL() app = Flask(__name__) # MySQL configurations app....
0
votes
0answers
30 views

Python SqlAlchemy | Error On Create Table

I'm a beginner of "Python with SqlAlchemy". I try the following to create the table in "MySQL" Database. My Code is : import pandas as pd from sqlalchemy import create_engine from sqlalchemy ...
1
vote
0answers
15 views

Specifying dtypes for read_sql in pandas

I would like to specify the dtypes returned when doing pandas.read_sql. In particular I am interested in saving memory and having float values returned as np.float32 instead of np.float64. I know ...
0
votes
0answers
10 views

Data is not storing properly in python sqlalchemy

I am starting with Python Flask to buid application but getting errors during api call. how can i solve this issue . My api.py from flask import Flask , render_template , flash , request, redirect ...
0
votes
1answer
27 views

ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb — Django 1.4 & Google App Engine

This will be the second time in my life posting about almost exactly the same thing. The difference between this time and last time is about 9 months, lots of difficult learning, and the fact that for ...
0
votes
0answers
22 views

Is it possible to get the execute summary after run python MySQLdb

all, In bash, when we run a mysql query with -svve, then we can get a summary of the execution of the query as below: query="update ..." mysql -svve"$query" result/summary after run the script ...
0
votes
1answer
16 views

bypass known exception of mysql in python

I am trying to bypass "Cannot delete or update a parent row: a foreign key constraint fails" inside my python script. So I am planning to drop all tables but this error throws up due to inter ...
1
vote
1answer
46 views

Using MySQLdb Python module with mysql_old_password

I need to use Python to connect to a database that uses the mysql_old_password authentication plugin. I do not have db admin access so I cannot change this setting, so please do not suggest that. I ...
0
votes
1answer
15 views

ConfigParser.NoSectionError: No section: 'metadata' in installing mysql-python

When I try install mysql-python to CentOs6.5 it casts a error python /sw/ple.bkp/workspace/tianfd/TEMP/MySQL-python-1.2.5/setup.py install Traceback (most recent call last): File "/sw/ple.bkp/...
-2
votes
2answers
57 views

truncated incorrect value

I have a python code that displays a range of dates. In the code below I have passed the dates in the select operation by casting the dates and using STR_TO_DATE function. I want to know how a range ...
0
votes
1answer
28 views

can a return value of a function be passed in the where clause

I have a python code that displays a list of station ID and air temperature for certain number of days. In the code below I have passed the dates as a list. But that is cumbersome coding since I have ...
0
votes
1answer
17 views

How do i fetching the image from the mysql database

Please give me some image fetching particular code which is help me to fetching the image from mysql database.I already store the image blob data into a database and then fetching it,but only ...
2
votes
0answers
45 views

“Can't initialize character set utf8mb4” with Windows mysql-python

I'm getting an error try to connect to a remote mysql database from a Windows 7 client via python 2.7 + MySQLdb 1.2.5 + sqlalchemy 1.0.9. This is a result of recently changing the server's default ...
1
vote
3answers
25 views

Getting Error while building mysql for python on Mac OS X El Capitan

I read some of the related topics and tried to implement those solutions to my situation but still I get the following error after this command : (project2_env) Efe-MacBook-Air:MySQL-python-1.2....
0
votes
0answers
33 views

error installing mysql-python and none of mentioned solutions worked

I just wanted to install Mysql-python, but every time errors occur. I have tried all mentioned solutions as installing wheel, using easy_install, renewing visual c++ for python, installing mysql ...
1
vote
0answers
22 views

Can't connect to MySQL server (111) even after changing bind-address

I wrote a few lines of code that sends data to a remote MySQL database. import MySQLdb db = MySQLdb.connect("MyServerIP","MyUserName","MYPwd","MyDB") # prepare a cursor object using cursor() method ...
0
votes
4answers
36 views

Synax error on db.close()

Im trying to use mysqldb in a python script. Here is a part of the code from the script cursor = db.cursor() sql = """INSERT INTO location(`name`, `lat`, `long`, `guid`, `image`, `date`)VALUES(%...
1
vote
1answer
21 views

Flask-MySQLdb raises _mysql_exceptions.ProgrammingError: closing a closed connection

I'm trying to use Flask-MySQLdb. Every time I go to a page I get the error _mysql_exceptions.ProgrammingError: closing a closed connection. Why isn't this working? from flask import Flask, ...
0
votes
0answers
25 views

Error loading MySQLdb

I'm facing problem while connecting mysql database in django. I'm getting error as raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)django.core.exceptions.ImproperlyConfigured: ...
-1
votes
1answer
29 views

Insert Ordered Dict values while using MySQL INSERT INTO

I encounter this error when I'm trying to insert some values into a table. Here's my code: def tsx_insert(self, d_list): for item in d_list: query = """ INSERT IGNORE INTO tsx_first_insert(...
0
votes
0answers
26 views

How to drop and recreate indexes in SQLalchemy ORM

I am using SQLalchemy ORM to build my database. I want to drop and recreate indexed in everytime I insert new data. I was wondering if there is any way to do this in SQLalchemy ORM? Thanks
-1
votes
1answer
19 views

python script throws mysql error when run on Ubuntu but not when run on OSX

I have a python script that deals with MySQL through the mysqldb connector. The same script runs perfectly fine on the my OSX machine while it breaks throwing a MySql error exception when run on an ...
0
votes
0answers
16 views

MySQLdb - OperationalError: (1136, “Column count doesn't match value count at row 1”)

I have the below script working on my Macbook pro, all executes correctly and inserts data into the database. I have just done a fresh install on my work iMac with the same python version and same ...
0
votes
0answers
14 views

python SSCursor lost connection to MySQLServer during query

I do the following: import MySQLdb from MySQLdb.cursors import SSCursor db = MySQLdb.connect(**conn_args) cur = db.cursor(SSCursor) q = 'select * from my_table_with_many_rows' it = cur.execute(q) ...
0
votes
1answer
24 views

Python MySQLdb Syntax Error with seemingly correct syntax [duplicate]

I'm trying to do a simple retrieval of a column named N_NUMBER in a MySQL table using the following code: from os.path import join, dirname from dotenv import load_dotenv import MySQLdb ...
1
vote
1answer
38 views

Error with pip install MySQLdb library

In python 2.7.10, Windows OS. Could not find a version that satisfies the requirement mysqldb(from version) no matching distribution found for mysqldb pip install MySQL-python also failed: Unable to ...
0
votes
0answers
13 views

Logging multiple-ultrasound data on a MySQL server with (arduino-ROS-Python) framework

I am trying to log the ultrasonic data from a RC car into a MySQL server. I am able to publish and subscribe to the data via rostopic. But I am having problem with the code for uploading the data ...
1
vote
1answer
30 views

Error:not all arguments converted during string formatting

I have this signup page and when i am submitting the form i am getting this error:not all arguments converted during string formatting class RegistrationForm(Form): email = StringField('Email address'...
-1
votes
1answer
13 views

Iterating over resultset with comparison of column name - in python with Mysqldb

i want to use python to populate a database. I have to get values out of a table, calculate a score and fill this score into anoter table. I cant figure out how i can compare the column names of a row ...
0
votes
1answer
28 views

Select column in one row and save as variable using python and mysqldb

first sorry for my bad english. i'm php programmer and I just started a python programming language. Mysql code: SELECT * FROM `datapy` ORDER BY `No` DESC LIMIT 0,1 And show row: +++++++++++++++++...
0
votes
1answer
34 views

Flask-MySQL gives “closing a closed connection” error the second time a view runs

I am using Flask-MySQL to connect to my database in a view. The view works the first time I go to it, but when I go to it the second time it always crashes with the error: ProgrammingError: closing ...
0
votes
1answer
20 views

MySQLdb TypeError: not all arguments converted

I have read other entries of the same error, and have attempted their solutions, but have had no luck with my code. columns = ['city', 'state', 'zip', 'latitude', 'longitude'] placeholder = '?' ...
1
vote
1answer
26 views

Python MySql make array of a Query

I have a MySql query, everything works fine, but I want to make an array of each row to be used out of the query Here is my code: db = MySQLdb.connect(host="127.0.0.1", user="root", passwd="", db="...
-2
votes
1answer
28 views

MySQL > Not showing data even when size is increasing and rows can be seen on a database viewer

Inserting lots of data in a mysql database. Steps being followed are : https://affiliate.itunes.apple.com/resources/documentation/epfimporter/ The problem is everything seems to be going well apart ...
1
vote
0answers
44 views

Not able to install mysql-devel on CentOS-7

On CentOS 7 The below error is reported when I do an yum install mysql-devel. Ultimately I want to install mysqlclient by resolving this first. Would Appreciate any help on this.Thanks.Python version ...
0
votes
1answer
24 views

MariaDB query from python code

I'm writing a python script that connects to a MariaDB server (V 10.1.12) and saves to file the results of some queries. However, when sending the following query: sql = 'SELECT * FROM ...
0
votes
0answers
9 views

how to insert different column header and values dynamically in mysqldb with python

will require all of ur help on this . My task is to insert 2087 column names to the mysqldb database but it will be crazy if i were to create row[firstheaderintable+1] ... to row[firstheaderintable+...
0
votes
0answers
19 views

mysql TIMESTAMPDIFF always returns 0 via python

I am trying to get seconds difference between 2 dates using MySQL time function TIMESTAMPDIFF. Below is my sample code. my_curs.execute("SELECT TIMESTAMPDIFF(SECOND, last_date, NOW()) FROM ...
0
votes
0answers
26 views

Python MySQLdb Lost connection to MySQL server during and uWSGI got Segmentation Fault

When connect.ping() throw MySQL exception: (2013, Lost connection to MySQL server during query), I reconnect MySQL, get a new connection (MySQLdb.connect), then to execute SQL. uWSGI crashed print ...
0
votes
1answer
24 views

Arduino Python Multiple Ultrasonic sensors upload to MySQL

import os from time import * import time import threading import serial import datetime import sys import MySQLdb as mdb ser = serial.Serial("/dev/ttyUSB0", 9600) distances = ser.readline() distances....
0
votes
1answer
36 views

python MYSQLdb execute() result doesn't match fetch result

Here is our code: db = get_connection() try: cursor = db.cursor() if not cursor.execute("SELECT id FROM test WHERE name = %s", ['name']) > 0: return None return cursor.fetchone(...
0
votes
0answers
15 views

Python Database Connetion Raise an Error

I have created database connection but it raise an error. I m using mysql through phpmyAdmin, But I have checked mysqldb its shows like: >>> import MySQLdb >>> yuvaraj.m@DLTEC007:...
0
votes
0answers
11 views

How is a list value in Python's MySQLdb.converters.conversions applied?

According to the documentation, the first half of MySQLdb.converters.conversions is a mapping from a MySQLdb.constants.FIELD_TYPE code to a function that can be used to translate a raw string of that ...
0
votes
3answers
30 views

Failed to insert the data using python.mysql connector

I'm new to using MySQL connector for python and I have the below-given data to be inserted into a table called "region_based_billings". I tried all possible ways to insert this data and it seems I ...
0
votes
1answer
30 views

Should I use python classes for a MySQL database insert program?

I have created a database to store NGS sequencing results. It consists of 17 tables to store all of the information. The results are stored in spreadsheets which I parse data from and store in ...