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).
0
votes
0answers
16 views
Python/MYSQLdb memory issues
I am running a script that is writing to a mysql database in the rough form of:
import MYSQLdb
import pandas as pd
def mysql_function():
db = MySQLdb.connect(host=something, user=something, ...
0
votes
1answer
6 views
How pip knows what path to include when compiles?
I am trying to install MySQL-python with pip for 64-bit python. For this I want to use MySQL Connector C 6.0.2 which installed under c:\Program Files\MySQL\, but pip tries find it in -IC:\Program ...
0
votes
1answer
23 views
python SQL query insert shows empty rows
I am trying to do a insert query in the SQL. It indicates that it succeed but shows no record in the database. Here's my code
conn = MySQLdb.connect("localhost",self.user,"",self.db)
cursor = conn....
0
votes
0answers
31 views
MySQL django backend unknown system variable
I have the following in my settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/etc/django/mysql_client.cnf'
...
0
votes
1answer
12 views
Installing MySQLdb on osx El Capitan for Python
I am trying:
brew install mysql
pip install mysql-python
I am getting this output:
Collecting mysql-python Using cached MySQL-python-1.2.5.zip Installing
collected packages: mysql-python Running ...
0
votes
1answer
22 views
Python3.4 int object is not iterable - MySQLdb
I'm running python3.4 and i'm trying to run a query with the MySQLdb library.
I've done one successful query but now I am stuck when it comes to integers in a query. Here's the code:
...
2
votes
0answers
24 views
On LOAD DATA LOCAL INFILE integer required error
I have a data file containing data in following format
asd,12,asd,asd,12,adsd,,asdas,None
I have a table in mysql which is has an auto increment int id and the rest of the columns as in data file.
...
0
votes
1answer
28 views
Using a variable as field name in MySQLdb, Python 2.7
This works when I replace the column variable with an actual column name. I do however need a variable. When I use a variable I get a MySQL syntax error. Can a field be a variable? If so, where is the ...
-2
votes
1answer
27 views
Error Inserting data to mysql server through mysqldb in python
MYsqldb is returning 1L when executing this:-
db=MySQLdb.connect('localhost','root','12345678','kitkat')
cur=db.cursor()
cur.execute("INSERT INTO justdial(id,email_raw,status) VALUES (NULL,'none','...
0
votes
1answer
32 views
how to for each the data that return by python3.5 from mysql
I use python3.5 and connect mysql to get the data. and I don't know how to get the data of each column without the way of creating a Model.
# encoding=utf-8
import mysql.connector
HOST = 'localhost'
...
3
votes
1answer
47 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
17 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
5 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
2
votes
0answers
72 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
27 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
30 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
37 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
24 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
11 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
45 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
17 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
65 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
23 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
24 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
70 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
41 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
56 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
24 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
37 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
31 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
33 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
32 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
27 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
21 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
19 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
1answer
28 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
49 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
14 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
37 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
15 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
29 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
41 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
38 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
57 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
29 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 ...