A thread-compatible interface to the popular MySQL database server that provides the Python database API.

learn more… | top users | synonyms (1)

0
votes
0answers
6 views

MySQLdb with python3.4

I am using python 3.4 on Lubuntu, which has by default both python2.7 and python3.4 I installed MySQLdb and am trying to use it in python3.4 using pip3 But merely import MySQLdb results in this ...
1
vote
3answers
4k views

Python 3.4.0 with MySQL database

I have installed Python version 3.4.0 and I would like to do a project with MySQL database. I downloaded and tried installing MySQLdb, but it wasn't successful for this version of Python. Any ...
3
votes
2answers
2k views

How to use python mysqldb to insert many values at once

I have a list of lists e.g [['a','b'],['c','d']] I have a table called T and two fields F1, F2. The first item in the field list maps to F1, second to F2. How in one transation insert into MySql ...
0
votes
0answers
10 views

LOAD DATA LOCAL INFILE by mysqldb python

I try use statment load data local infile by mysqldb in python 2.7. I obtain following error: OperationalError: (1148, 'The used command is not allowed with this MySQL version') I used solutions from ...
1
vote
1answer
30 views

Exception Value: (2002, “Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)”)

Hello guys I'm getting this error again and again on my deployment server. The site seems to work fine for some time but then again it crashes and shows this error This is the trace back ` ...
0
votes
1answer
27 views

cxFreeze error: resource_filename() only supported for .egg not .zipp

I have a fully working wxpython based application, written all in Python. I wanted to make an exe, so I used cxFreeze. During the build, there are many modules which seem to be missing, which ...
0
votes
0answers
15 views

'Error:The used command is not allowed with this MySQL version' by mysqldb

I try use LOAD DATA LOCAL INFILE statement by mysqldb in python. I obtain follwing error. OperationalError: (1148, 'The used command is not allowed with this MySQL version') and I set the option in ...
0
votes
1answer
15 views

Import MySQLdb not working in python

I have executed the following command to install mysqldb : apt-get install python-mysqldb it returned : Reading package lists... Done Building dependency tree Reading state information... ...
0
votes
2answers
18 views

Installing MySQL-python with easy-install failed

I'm struggling with installing MySQL-python on my Centos VPS. I have "main" Python 2.6 (one that came automatically with CentOS) and another one I installed after (2.7). So I used this command: ...
1
vote
1answer
5k views

EnvironmentError: mysql_config not found

EnvironmentError: mysql_config not found, while installing MySQL-python Could someone advice me on what to do? I did the following from my-side: Error I got while installing with pip: ...
0
votes
1answer
376 views

MySQLdb: how to connect with phpMyAdmin

I have a LAMP server and then I installed MySQLdb for my Python scripts. Now I can't access the MySQL (from LAMP) from Python scripts because it isn't connecting to the MySQLdb, and also I can't ...
10
votes
5answers
13k views

mysql: get column name or alias from query

I'm not asking for the SHOW COLUMNS command. I want to create an application that works similiarly to heidisql, where you can specify an SQL query and when you execute it ... you get a result set ...
0
votes
1answer
21 views

error “No module named MySQLdb”

After importing the module, on script run I get the error and I have the module installed already, I am new with python, so I expect I might have forgot to install something else? Python is version ...
0
votes
0answers
27 views

Using module without previously installing it

Firstly, thanks for will to help and reading this question. Few days ago I started working on an Python project which uses MySQLdb to connect to MySQL database. Problem is that I don't want my ...
1
vote
1answer
22 views

Using the python MySQLDB SScursor with nested queries

The typical MySQLdb library query can use a lot of memory and perform poorly in Python, when a large result set is generated. For example: cursor.execute("SELECT id, name FROM `table`") for i in ...
1
vote
3answers
39 views

filter result based on the date(month and year)

How to get the result based on below query. This is my model.py class Revenue_Report(models.Model): value = models.CharField(max_length = 100) value_name = models.CharField(max_length = ...
0
votes
2answers
6k views

warning :data truncated for column 'username' at row 1 when using database mysql with django

I am getting the above mentioned warning data truncated for column 'username' at row 1 I am getting this for my model "suserprofile" with "username" as my first listed field ...
0
votes
1answer
34 views

python script for inserting batch data into mysql table

I'm writing a python script for inserting a csv file into a mysql table. The problem I am having is that it is only inserting one line and terminating after that. #!/usr/bin/python import sys ...
2
votes
1answer
38 views

python+MySQLdb, simple select is too slow compared to flat file access

I have one simple table with 80 000 rows. I'm trying to select and save all rows to python list as fast as possible. It's taking around 4 - 10 seconds. In contrast If I dump exact same table into ...
-1
votes
1answer
34 views

Tuple Index Out of Range (PyQt + Mysqldb)

i'm put a form from PyQt4,i take the example, from a previous answer, but i'm getting the "Tuple index out of range". My code is follow. cursor.execute("SELECT id_cliente as 'Codigo del cliente', ...
0
votes
0answers
19 views

Python PrettyTable printing table on same line

I'm using PrettyTable 'from_db_cursor' module to print nicely the responses I get from my sql requests. Everything works fine, my only problem is that for some of the queries i would like to print the ...
0
votes
1answer
17 views

Executing MySQL Queries in Python not work properly

I have problem with queries in python script. In phpmyadmin the same queries works properly, but in script, second query not work. (No errors, no Insert) my code: from sys import argv import ...
0
votes
1answer
16 views

Python MySqlDB store_result returns only one row

I'm using MySqlDB to execute many queries that I have in a dictionary, my problem is that store_result() only returns one of the severals statistics I wan't to get. Here on of the query that gives me ...
1
vote
0answers
38 views

Anaconda python : gcc.exe: error: /Zl: No such file or directory

please help !! I'm trying to resolve some python exercices , so in the begining I was trying to resolve the problem of importing MySQLdb , I used this command : pip install MySQL-python under the ...
0
votes
1answer
21 views

2 Try / Except statement doesn't work in normal order but works when codes are flipped

Good day guys, I hope to get a little advice on this. I can't seem to get this 2 TRY/EXCEPT statement to run in the order I want them to. They however, work great if I put STEP2 first then STEP1. ...
0
votes
1answer
14 views

NameError on Script & DB Insert

I am trying to use the Python script here for my own purposes. I'm no Python bloke, so hopefully someone can see what I have wrong. Is it an indent error? Traceback (most recent call last): File ...
0
votes
0answers
19 views

Installating python on centos

I have installed python2.7 on centos by following tutorial http://bicofino.io/blog/2014/01/16/installing-python-2-dot-7-6-on-centos-6-dot-5/, now i am having two version of python in at my centos5, ...
-1
votes
0answers
15 views

ValueError: ['path'] while installing MySQL-python on Windows 7

Running MySQL-python-1.2.5\setup.py -q bdist_egg --dist-dir c:\users\acer\appdat a\local\temp\easy_install-x603yb\MySQL-python-1.2.5\egg-dist-tmp-u49dhr Traceback (most recent call last): File ...
0
votes
2answers
48 views

How can I switch my Django project's database engine from Sqlite to MySQL?

I need help switching my database engine from sqlite to mysql. manage.py datadump is returning the same error that pops up when I try to do anything else with manage.py : ImproperlyConfigured: Error ...
2
votes
1answer
27 views

celery always have 3 processes,why?

I run the crawler application with celery(version 3.1) tasks and django(version 1.6.5. using its orm).And the command is : celery -A crawlerproj worker -P gevent -c 1000 -l info by using the 'htop' ...
0
votes
2answers
17 views

mysqldb UPDATE function Python error str

I would need your help with updating data in my mysqldb through python. Everything works fine including reading, inserting, etc. The following query does not work... cursor.execute("UPDATE ...
-2
votes
0answers
32 views

can I pass warning using exception? [duplicate]

Hi can I pass warning using try/except? something like that: try: cur_to.execute('''create table if not exists copy_data(id int(10) primary key auto_increment,base_id varchar(20), tanks_id ...
4
votes
2answers
9k views

Create MySQLdb database using Python script

I'm having troubles with creating a database and tables. The database needs to be created within a Python script. #connect method has 4 parameters: #localhost (where mysql db is located), #database ...
1
vote
0answers
25 views

Python MySQLdb not refreshing database information

I'm currently codiing a simple IRC moderator/utility bot. I plan to have a web interface that will easily update command data and whether or not the command is enable using a MySQL database to store ...
1
vote
3answers
3k views

Install mysql-python (Windows)

I've spent hours trying to make Django work on my computer. The problem is that I can't install the mysql-python package. I'm running Windows 7 64bit. This is what I've tried: I have downloaded ...
0
votes
2answers
23 views

Python: Iterating through MySQL columns

I'm wondering if you can help me. I'm trying to change the value in each column if the text matches a corresponding keyword. This is the loop: for i in range(0, 20, 1): cur.execute("UPDATE table ...
12
votes
2answers
4k views

MySQLdb for Python 2.7 on OSX 10.8.2 and BOTH are 64 bit

Here's my problem: I can't Get MySQLdb for python working. Most of the other posts regarding this have cited having different architectures of MySQL/Python. I checked, and they're both 64 bit. I have ...
1
vote
4answers
614 views

MySQL Connector in Python does not allow LOAD DATA INFILE Syntax

I' m trying to send a text file into MySQL database. I am trying to do this with mysql connector in python 3.2. The problem is about LOAD DATA INFILE syntax. You can find my code above. My first ...
0
votes
0answers
11 views

Python MySQLdb insert query not working [duplicate]

I am writing a python script that is supposed to insert a list of names from an array (where they are stored as strings) into a table. When I run the dbInsert() method it runs perfectly, however ...
1
vote
1answer
19 views

cursor.execute(…) for string prefix search

Suppose I have want to do a string prefix search in database, say select * from some_table where name like 'abcde%'; where abcde is actually some user input string. How do I do it in MySQLdb in ...
2
votes
2answers
605 views

mysql_config not found when installing mysqldb python interface for mariadb 10 Ubuntu 13.10

After I installed Mariadb 10 the Mysql workbench and JPDB client both connect and work fine so next step was get programming with Python (using SQLAlchemy) which seems to require MySQL-python so I ...
0
votes
0answers
16 views

Django forcing UTF-8 on misconfigured MySQL Server

I am using the MySQL-Python driver v1.2.5 with Python 2.7.x and Django 1.5.x. I have a situation where I require a Django application to work entirely in UTF-8, yet the production MySQL server is ...
0
votes
0answers
31 views

How to Escape special characters during insertion in python-mysql?

I am scraping some data-points from a webpage using python and storing it into list. Now i want to store this list into different columns of the table. The data i am pulling is having some special ...
0
votes
2answers
1k views

Python import Column Data from MySQL as Array

I have this code which retrieves data from a mysql table. I am using Python's MySQLdb module. I want EACH column's data based on the SELECT WHERE condition to be retrieved under an array. For ...
-1
votes
1answer
31 views

MysqlDb and Pyqt4 comparing variables

I have a Database in mysql, and i'm working in a app in QT4, i'm using Mysqldb connector, im ready sucessfull conected the db, but when i'm querie the tb "t_usuarios" im dont know how to eval it. can ...
0
votes
1answer
22 views

Python MySQLdb: Iterating over a cursor

In another post, this code: connection = MySQLdb.connect(...) cursor = connection.cursor() cursor.execute("SHOW TABLES") for (table_name,) in cursor: print(table_name) correctly iterates over ...
-2
votes
1answer
25 views

MySqldb Eror on Global name:db

and thanks, i'm put my question, here, but, first i search this site entirely, and dont find, the correct answer for it. and i'm noob in Python and PyGTK. here is my code: from PyQt4 import uic ...
0
votes
0answers
34 views

Python import MySQLdb error

I'm having trouble importing MySQLdb to python. I'm using python 2.7 in Mavericks. I followed this helpful post (and links therein) to install, and it all looked good up until the end. But I am ...
-1
votes
1answer
22 views

Issue with Select Statement for MySQLdb Python

I need to process the output of scrapy and store it to mysql using mysqldb. The below code works fine for article table however i need to access the category_id to insert in articlecategory table as ...
0
votes
1answer
21 views

MySQL in Python complaining about placeholders

I've been trying to use python's MySQLdb to execute SQL on a MySQL Database from SSH on my webhost. This program i wrote (on a mac) should print a table, but it doesn't. Here's my code: import ...