--On 2. Januar 2008 11:11:20 -0500 Michael Bayer <[EMAIL PROTECTED]> wrote:
On Jan 2, 2008, at 2:56 AM, Andreas Jung wrote:I have a PG table containing a row tools varchar(256)[][] that stores a list of tuples ('HI1234', 'somestring'). Setting the tools property on Python level leads to bad SQL code: ProgrammingError) Fehler »syntax error« bei »,« at character 52 'UPDATE hierarchies SET tools=%(tools)s WHERE hierarchies.id = % (hierarchies_id)s' {'tools': [('HI641774', ''), ('HI508670', ''), ('HI788784', ''), ('HI952450', ''), ('HI884580', ''), ('HI642122', ''), ('HI1496415', '')], 'hierarchies_id': 7667} Is there a workaround in SA 0.3 for working with arrays? I assume the PGArray type in SA 0.4 would resolve this issue..however the code base is too big right for doing the switch to SA 0.4 now.
Converting the list of tuple to the desired string representation like '{{"HIXX", "foo"}, {"HIYY", "bar"}}' and assigning the string to the 'tools' property did the job. Andreas
pgpDWBzhTjWIO.pgp
Description: PGP signature