Tomas and the Pearl Jam body

Last year I bought a Pearl Jam baby body at the Rock Werchter Festival. Our baby boy wasn’t born yet, but we waited patiently.. until today! Lucky my wife washed and put it on because it might have been too small in 2 weeks.

Pearl Jam fans

Not sure Tomas will be a fan of Pearl Jam, but the black suits him well. Oh, and on his bottom it says “I got shit”. Pearl Jam fans know.

MySQL Performance Tuning at PHPBenelux 2011 Conference

I’ll be giving a workshop/tutorial on MySQL Performance Tuning at the PHPBenelux 2011 Conference in Belgium. It’s 3.5 hours and I am sure I can discuss the new MySQL v5.5 release too.

Lots of stuff will be discussed, including configuration, understanding status variables, finding bad queries, schema tips, etc..

If you got particular ideas or concerns and are attending, just leave me message or just comment on this blog post. I’ll see if I can fit it in.

Maybe we can fix the deadlocks in Belgian politics too? Ah, who am I kidding..

By |January 11th, 2011|MySQL, Work|0 Comments|

MySQL Connector/Python v0.3.2-devel released

MySQL Connector/Python 0.3.2, a development release, is available for download:
https://launchpad.net/myconnpy/+download

Disclaimer: Since version 0.3 is still a development release, or ‘alpha’, it is not
recommended to run this in production.

MySQL Connector/Python 0.3.2-devel is a maintenance release fixing following bugs:

  • lp:701081 -Doesn’t install with Python 2.4

About MySQL Connector/Python: MySQL Connector/Python is implementing the
MySQL Client/Server protocol completely in Python. No MySQL libraries
are needed, and no compilation is necessary to run this Python DB API v2.0
compliant driver. It is compatible with Python v2.4 and later as well as
Python v3.1 and later.

MySQL Connector/Python v0.3.1-devel released

MySQL Connector/Python 0.3.1, a development release, is available for download:
https://launchpad.net/myconnpy/+download

Disclaimer: Since version 0.3.1 is still a development release, or ‘alpha’, it is not
recommended to run this in production.

MySQL Connector/Python 0.3.1-devel is a maintenance release fixing following bugs:

  • lp:695514 – Infinite recursion when setting connection client_flags
  • lp:691836 – Incorrect substitution by cursor.execute when tuple args contains ‘%s’

About MySQL Connector/Python: MySQL Connector/Python is implementing the
MySQL Client/Server protocol completely in Python. No MySQL libraries
are needed, and no compilation is necessary to run this Python DB API v2.0
compliant driver. It is compatible with Python v2.4 and later as well as
Python v3.1 and later.

Setting client flags with MySQL Connector/Python

Setting client flags with MySQL Connector/Python works a bit differently than the other MySQL Python drivers. This blog post describes how to set and unset flags, like the CLIENT_FOUND_ROWS.

The default client flags for the MySQL Client/Server protocol can be retrieved using the constants.ClientFlag class:

>>> from mysql.connector.constants import ClientFlag
>>> defaults = ClientFlag.get_default()
>>> print ClientFlag.get_bit_info(defaults)
['SECURE_CONNECTION', 'TRANSACTIONS', 'CONNECT_WITH_DB',
 'PROTOCOL_41', 'LONG_FLAG', 'MULTI_RESULTS',
 'MULTI_STATEMENTS', 'LONG_PASSWD']

To set an extra flag when connecting to MySQL you use the client_flags argument of connect()-method. For example, you’d like to have the CLIENT_FOUND_ROWS set:

import mysql.connector
from mysql.connector.constants import ClientFlag
extra_flags = [ClientFlag.FOUND_ROWS]
cnx = mysql.connector.connect(client_flags=extra_flags)

Similar, you can unset a flag passing a list of negative values, or all at the same time. For example, you’d like the CLIENT_FOUND_ROWS set, but you don’t want CLIENT_MULTI_STATEMENTS:

import mysql.connector
from mysql.connector.constants import ClientFlag
extra_flags = [ClientFlag.FOUND_ROWS, -ClientFlag.MULTI_STATEMENTS]
cnx = mysql.connector.connect(client_flags=extra_flags)

It is also possible to pass the client_flags an integer, but you need to get first the defaults, and do bitwise operations to set/unset flags yourself. At the moment of writing, there is a bug about this, see lp:695514, but I recommend using the list-method.