20th September, 2006

Python 2.5 and Generic Database Connection Utilities

Filed under: database,python — admin @ 2:36 pm

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 dburi.py and there is a text version of the file called dburi.py.txt. Patches are gratefully accepted.

13th September, 2006

New Toys

Filed under: General — admin @ 2:58 pm

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.

5th September, 2006

Oracle Have A Half Open Kimono

Filed under: database — admin @ 12:17 pm

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 oracle.com 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 oracle.com 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.

Powered by WordPress