Tagged Questions
120
votes
7answers
70k views
How do I connect to a MySQL Database in Python?
How do I connect to a MySQL database using a python program?
99
votes
8answers
69k views
Getting “Error loading MySQLdb module: No module named MySQLdb” - have tried previously posted solutions
This is a much discussed issue for OSX 10.6 users, but I haven't been able to find a solution that works. Here's my setup:
Python 2.6.1 64bit
Django 1.2.1
MySQL 5.1.47 osx10.6 64bit
I create a ...
88
votes
2answers
32k views
Installing specific package versions with Pip
I'm trying to install version 1.2.2 of the MySQL_python adaptor. The current version shown in PyPi is 1.2.3. Is there a way to install the older version? I found an article stating that this should do ...
75
votes
14answers
54k views
MySQL for Python in Windows
I am finding it difficult to use MySQL with Python in my windows system.
I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) ...
48
votes
3answers
28k views
Why can't easy_install find MySQLdb?
This is what I tried:
$ easy_install-2.6 -d /home/user/lib/python2.6 MySQLdb
Searching for MySQLdb
Reading http://pypi.python.org/simple/MySQLdb/
Couldn't find index page for 'MySQLdb' (maybe ...
47
votes
4answers
18k views
virtualenv, mysql-python, pip: anyone know how? [duplicate]
I'm trying to install the mysql bindings in a virtualenv. I'd prefer to use pip or easy_install. pip gives me the following error:
File "setup_posix.py", line 24, in mysql_config
raise ...
46
votes
6answers
12k views
How to run django's test database only in memory?
My django unit tests take a long time to run, so I'm looking for ways to speed that up. I'm considering installing an SSD, but I know that has its downsides too. Of course there are things I could ...
46
votes
6answers
66k views
Python issue:Unable to find vcvarsall.bat [duplicate]
Possible Duplicate:
error: Unable to find vcvarsall.bat
I'm trying to install MySql interface for python, but I got an error (mentioned below). And I know the solution: install Microsoft ...
43
votes
5answers
37k views
How to install MySQLdb (Python data access library to MySQL) on Mac OS X?
I'm a Python newbie, but I've just spent a day working out how to get MySQLdb working properly, and the universe according to google includes numerous references to what a PITA it is, and an ...
34
votes
6answers
21k views
MySQL “incorrect string value” error when save unicode string in Django
I got strange error message when tried to save first_name, last_name to Django's auth_user model.
Failed examples
user = User.object.create_user(username, email, password)
user.first_name = u'Rytis'
...
32
votes
3answers
12k views
Whether to use “SET NAMES”
In reading "High performance MySQL" from O'Reilly I've stumbled upon the following
Another common garbage query is SET
NAMES UTF8, which is the wrong way to
do things anyway (it does not ...
30
votes
4answers
15k views
Python: MySQLdb and “Library not loaded: libmysqlclient.16.dylib”
The setup...
Trying to set up a clean Mac os X 10.6 install to develop python/django and I didn't remember running into this on 10.5.
After installing MySQL from the installer on ...
30
votes
10answers
79k views
How to install MySQLdb package? (ImportError: No module named setuptools)
I am trying to install MySQLdb package. I found the source code here.
I did the following:
gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py ...
27
votes
4answers
15k views
In Python, after I INSERT Into mysqldb, how do I get the “id”?
The primary key.
cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height))
My table has 2 columns:
id << primary, auto increment
height << this is the other column.
How do I ...
21
votes
1answer
6k views
Bulk insert with SQLAlchemy ORM
Is there any way to get SQLAlchemy to do a bulk insert rather than inserting each individual object. i.e.,
doing:
INSERT INTO `foo` (`bar`) VALUES (1), (2), (3)
rather than:
INSERT INTO `foo` ...