Re: uuid array example?

Brian Jones <[email protected]> Fri, 26 Mar 2010 16:45:12 -0400
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Fri, Mar 26, 2010 at 3:55 PM, Brian Jones <[email protected]> wrote:

> Hi all,
>
> I have the privilege of migrating a lot of php code over to Python, and
> came across a SQL query embedded in the PHP code that looks kinda like this:
>
>
>
> SELECT widgets.shipped_by_id( :widget_id, :cust_id, CAST(' . $order->
> 'item_ids'} ) . ' AS uuid[])
>
> I noticed that psycopg2 now supports the uuid array in the docs, but the
> code example was a little confusing, and it didn't really cover the arrays.
> Is it enough to create a python list populated with Python uuid values? Do I
> then have to manually run the array through UUID_adapter or something in
> order to get a value I can use in a query?
>
> Thanks.
>

I just found the UUID array tests in the source tree. Looks like I just need
to register the type using register_uuid(), make sure all the array values
are python UUIDs, and drop the name of that array in the query. If I've
missed something let me know. I won't be able to test with live data for a
while.

Thanks,
brian


>
> --
> Brian K. Jones
> Python Magazine  http://www.pythonmagazine.com
> My Blog          http://www.protocolostomy.com
>



-- 
Brian K. Jones
Python Magazine  http://www.pythonmagazine.com
My Blog          http://www.protocolostomy.com

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg