Thursday, March 19, 2009

MySQL-python-1.2.3 beta 2 released

I released the second beta of MySQLdb-1.2.3 over the weekend. So far I've gotten a fair number of downloads but not a lot of feedback. I did find out though what small tweaking is required to build on Windows. It's also in the Python Package Index, so if you can also install using easy_install MySQL-python. Once I make the final release of 1.2.3, I'll put up more eggs for fringe operating systems (Mac OS X, Windows).

9 comments:

anatoly techtonik said...

It is impossible to install it using easy_install from source without installed MySQL and compiler. The most problematic thing is that there is no descriptive error message from easy_install. The reason for failure is unchecked call to OpenKey() I've left a comment on your SF thread, but I am not sure updates are sent from there if I am not subscribed.

Unknown said...

You make that sound like a surprise, but the README makes this quite clear: A C compiler and you need MySQL development headers and libraries installed are prerequisites.

anatoly techtonik said...

It is not about requirement - it is about easy_install behaviour. I'd expect it to tell what to do next. BTW, I would vote for placing this extension as a module to be downloaded in case of:

easy_install mysql

Unknown said...

There will be a binary egg release for Windows for 1.2.3, provided someone makes one for me to distribute, which is likely. I don't make binary releases for pre-releases.

s7v7nislands said...

hi, why don't catch exception after mysql_use_result and mysql_store_result?

Unknown said...

It now fails on OpenSolaris like this:
> easy_install mysql-python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Reading http://sourceforge.net/projects/mysql-python/
Best match: MySQL-python 1.2.3c1
Downloading http://osdn.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3c1.tar.gz
Processing MySQL-python-1.2.3c1.tar.gz
Running MySQL-python-1.2.3c1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EdcRxe/MySQL-python-1.2.3c1/egg-dist-tmp-kUQtg9
"/opt/csw/include/python2.5/pyport.h", line 761: #error: "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
cc: acomp failed for _mysql.c
error: Setup script exited with error: command 'cc' failed with exit status 2

1.2.2 installed on the same system with no problems.

Litewerk said...

I'm not sure which versions of MySQL, but at least some of the 5.0 versions do NOT report the MYSQL_TYPE_SET or MYSQL_TYPE_ENUM resultset column types properly. They are returned as MYSQL_TYPE_STRING with the flags set to either SET_FLAG or ENUM_FLAG. I have fixed your code for my server and wish to share it with the world. Simply add:

#define REAL_TYPE(t, f) ((t) != MYSQL_TYPE_STRING ? (t) : ((f) & SET_FLAG ? MYSQL_TYPE_SET : ((f) & ENUM_FLAG ? MYSQL_TYPE_ENUM : (t))))

Near the top of _mysql.c. Then replace the two instances of fields[i].type with REAL_TYPE(fields[i].type, fields[i].flags).

I hope this helps save someone 10 hours of trying to figure out why Sets are returned as Strings. I would probably suggest this as a pretty safe change to make to the core product. If you want a binary for 1.2.3b2 for windows compiled for Python 2.4, message me. I can probably get other versions compiled for you too if you ask nicely.

Unknown said...

Andy,

I've just started using MySQLdb and Python and found it really useful. Is it possible to implement the MySQL JOIN command on multiple tables in Python/MySQLdb? I've searched everywhere but most articles demonstrate create table and insert but not JOIN. Any help appreciated

yours

Doug

Unknown said...

Doug, there is nothing special about JOINs, but if you are having problems, try posting in the SourceForge forums.