Python 2.5 and Generic Database Connection Utilities

Python 2.5 has been released today. Yay. I look forward to utilising some of its fine language features in my future code.

But, and you knew there was a gripe coming didn't you? With the inclusion of the pysqlite module as part of the standard distribution there is a problem. It has been renamed from pysqlite2 to sqlite3. A move I agree with by the way, as it is clear from the name exactly what the module supports.

The problem is I've got quite a bit of code that uses the old name. Where my existing scripts say;

>>> from pysqlite2 import dbapi2 as sqlite

They now need to say;

>>> try:

...     from pysqlite2 import dbapi2 as sqlite

... except ImportError: # for Python 2.5 and above

...     from sqlite3 import dbapi2 as sqlite

>>> myDb = sqlite.connect('sqlitedatabasefile.db')

Or they would, if I hadn't cunningly stolen an idea from SQLObject, which they borrowed from any number of other places, and written my own little connection function. So my scripts can carry on using;

>>> from utilities.dburi import get_connection

>>> myDb = get_connection('sqlite:/sqlitedatabasefile.db')

Fancy a look at the code? Oh, ok then, it's called and there is a text version of the file called Patches are gratefully accepted.

New Toys

Today I snapped and decided to unplug the mouse that was supplied with my work computer, it was rubbish. I've now replaced it with a shiny new wireless mouse. It is smashing and I highly recommend that particular model to anyone who like me has normal sized hands and doesn't need micro-millimetre mousing precision. It was very reasonably priced too.

I was tempted to write a diatribe about why the equipment I am supplied with for eight or more hours of work a day is so poor but, you know, why bother? I think the fact that I've gone out and spent my own money on what is an essential work tool says it all really.

Oracle Have A Half Open Kimono

Sometimes I think that the nice people at Oracle get the new information technology world. Sometimes I even think that they understand the web and it's associated technologies. Then they do something stupid.

The latest crime? Publishing syndication feeds of various columns on the Oracle Technology Network but then putting the content on a site that is only available to registered users.

I subscribed to the feed for Steven Feuerstein's PL/SQL questions and answers. It is, of course, a headline and excerpt only field - a particular bête noire of mine - so I clicked on an article headline in my feed reader expecting to be taken to the relevant article. But no, the information architects have decreed that you can't casually view this premium content, you have to sign in to with an account.

People, it's just the web. It's not like I'm trying to buy anything. Why should I have to sign in to a web site to read an article on the overhead of DBMS_OUTPUT?

The only conclusion I can reach is that they really don't get this here web thing, and that makes me sad.

In the interests of completeness the article I was referring to is here (have your user name and password handy) and Steve's conclusion is largely correct. Although I would recommend using a package like Log 4 pl/sql rather than rolling your own (inevitably) halfcooked logging solution.

Sydney Python Pub Night

For the next meeting of the Sydney Python group we are trying something a little different. Next Thursday, the 7th of September, we are having a pub night. The gathering will take place from 6:30pm at the Grace Hotel on the corner of King and Clarence Streets in the city.

There is no fixed agenda or prepared presentations. I suspect that laptops will be opened and ideas exchanged though. All are welcome, we'd be especially chuffed if people who aren't Python aficionados come along and share some knowledge. It would be great if we could turn this into something like the London 2.0 meetings.

As usual the details are on

Location Tagging Photos

Today Flickr, my photo management web site of choice (sorry Charles) have launched support for geo-tagging photos. Which is nice. I particularly like the way it has been implemented. You just select your photos in the organizr and then click on the map tab where you mark the location they were shot in. I'm not entirely convinced by the value of this (why do I need to know where my house is for instance?) but my inner librarian absolute revels in this kind of classification.

Of course if you're in Australia the Yahoo! Maps support is somewhat spotty. Why am I surprised? They've managed to get the names of the major cities and towns on their map of the big brown land but that's about it. Which means that until the people with the exclamation mark get their data updated to include the backwater I live in I'll be sticking with the localize bookmark from Sumaato. Even if it does leave rather untidy 'geo:lon' and 'geo:lat' tags on my photos it at least includes coverage of the places they were taken in.

OSDC Proposal Submitted

Prompted by Mark and in an effort to keep up with Alan I've submitted a proposal for a presentation at OSDC 2006.

If they like my proposal I'll be appearing in a lecture theatre in Melbourne in December talking about databases and Python. I'm being quite ambitious in scope for a thirty minute slot with discussion of the Python Database API, a side trip into JDBC and Perl's DBI and then a discussion of database wrapper utilities, ORM implementations and patterns. I suspect that there will be some judicious editing before I'm finished, although I will try and keep all the topics in my conference paper.

July Sydney Python Meeting

Its been a while since the last one, but I'm glad to say that the first Sydney Python meeting of 2006 is nearly here. The date is the 27th of July, 2006 and the time is 6:30pm. The venue is new, we'll be getting together at the school of IT building at Sydney University, but the content and discussion should be as good as ever.

For details, and to let us know if you are coming see the meeting notice on Discussion takes place on the Sydney Python mailing list.

Congratulations to Mark for organising and I'll see you all there.

Idiotic Corporate Policies

I have mentioned before some of the interesting policies of a consulting company of my acquaintance. But sadly recently there has been more head scratching.

Item the first: when laptops are delivered from their preferred supplier they remove the wi-fi card. This is apparently for "security". Naturally everyone who receives one of these machines then goes to the store and buys a PCMCIA wi-fi card and puts it on their expenses.

Item the second: they have a VPN. Which is nice because they are a consulting company and the majority of their staff work on client sites. Except it's virtually impossible to get access to, for "security" reasons. When this gift is granted to an employee I'm informed that they aren't trusted to install and configure the VPN software themselves, they have to take their work laptop (without a wi-fi card) to the office to get someone from technical support to set up their access. Of course the problem here is that their employees need this VPN access because they aren't in the office, but that doesn't seem in any way ironic to them.

The mind boggles.

Same As It Ever Was

Welcome to the new blog. It's the same as the old blog, just with a slightly different URL and a whole new back end.

Expect more entries, or less. It depends on how inspired I get.