enough water makes all rocks round

python

PythonDoc Wiki Macro for Trac

In a time long, long ago in a cubicle far, far away, I once wrote a wiki macro for Trac to generate documentation from python modules in a Subversion repository using PythonDoc.
(more…)

Advertisements

SELECT Surprise

While experimenting with unicode values in Python, PostgreSQL and pyscopg2, I ran a little query like this:

>>> cur.execute("SELECT (note_id, body) FROM troy.morenotes")
>>> cur.fetchall()
[('(1,"The rain in Spain falls mainly in the plains.")',),
('(2,"Twenty dwarves did handstands on the carpet.")',),
('(5,I\xc3\xb1t\xc3\xabrn\xc3\xa2ti\xc3\xb4n\xc3\xa0liz\xc3\xa6ti\xc3\xb8n)',)]

(more…)


Automatic Pickle Serialization and Deserialization with PostgreSQL

Building on the earlier success of creating a pickle data type in PostgreSQL, I’ve come up with this small and comfortable way of automatically serializing and de-serializing python pickles with PostgreSQL and psycopg2.

(more…)


Cheat Sheet for Kid Templates

Kid Templates rock! In an effort to learn and memorize the syntax, I created a cheatsheet for it using Inkscape.
Attached is the PNG export and the SVG source. Enjoy!

(I’ve removed the SVG source because WP won’t allow the attachment – troy 24 jan 2010)

A Tale of PostgreSQL Types and Python

Thinking of integrating user-defined types in PostgreSQL and psycopg2? Here’s the path I walked, hopefully you can avoid the same pitfalls.

I was after a PostgreSQL data type for storing Python pickles. This seemed simple enough because the database facility for aliasing a type already exists. So the first thing I tried was a CREATE DOMAIN statement in PG, like so:
(more…)