This weekend I’m pushing more code which makes MySQL Connector/Python more and ultimately fully compliant with the Python Database API v2.0 specification, aka PEP 249. I wrote my own unittests for this, but later I stumbled upon already made cases form which I’m stealing some ideas. $ ./unittests.py -t pep249 Connection object has close()-method ... ok Connection object has commit()-method ... ok Connection object has cursor()-method ... ok Connection object has rollback()-method .
Moving Django backend out of MySQL Connector/Python's trunk
Today I removed the Django backend using MySQL Connector/Python out of the trunk and made it available through another branch on Launchpad. I’m not officially maintaining this, but it is used in my Django-powered homepage. I had to pull it out because I couldn’t keep up compatibility with newer versions. Maybe a backend using Connector/Python 1.0 might go into Django as an alternative to MySQLdb? Who knows!
One month: bye bye DSL and Mobile phone contracts
The past months I’ve been busy canceling every contract that binds me for more than a year to one company. The insanely expensive iPhone contract by T-Mobile and the excellent but expensive T-Online services are two of them. It was all payed by my employer. I say ‘was’, but I’ll keep my thoughts on that for myself. I’ll save my company ±100 EUR every month, but how I’ll get online? Well, for phone I’m using pre-paid in 3 countries without these insane contracts.
Fixing Python's DeprecationWarning sha
I thought I fixed this few days ago, but apparently I totally forgot to run the tests. First time I have to go around a DeprecationWarning, and I thought it was cool to share. Maybe I’m totally doing it incorrectly, but at least I used a lambda! Whee!.. /mysql/connector/protocol.py:21: DeprecationWarning: the sha module is deprecated; use the hashlib module instead try: from hashlib import sha1 except: import sha sha1 = lambda s: sha.
Getting illegal dates from MySQL with Connector/Python
Today we received a bug report saying that we shouldn’t throw an exception but instead return what MySQLdb is returning. Bit research and MySQLdb is actually returning None for illegal dates: good! There is now a fix (showing up soon) on Launchpad which will return dates as None where they are inserted as '0000-00-00'. A few lines of Python: .. data = [ (datetime.now().date(),datetime.now()), ('0000-00-00','0000-00-00 00:00:00'), ('1000-00-00','9999-00-00 00:00:00'), ] for d in data: stmt_insert = "INSERT INTO %s (c1,c2) VALUES (%%s,%%s)" % (tbl) try: cursor.