From: Michael H. <Mi...@Hi...> - 2005-04-29 14:17:24
|
Billy G. Allie wrote: > On Mon, 2005-04-25 at 13:42 -0500, Michael Hipp wrote: > >>I'm really hoping someone can tell me I'm doing something wrong ... >> >>I have a table that has a complex (user defined) type like this: >> >>CREATE TYPE addr_phone AS ( >> addr1 character varying(40), >> addr2 character varying(40), >> city character varying(40), >> state character(2), >> zip character(5), >> phone character(12)) [snip] > pyPgSQL doesn't know about user created types. You would need to create > a python type that represents yoour created type and then instantiate an > object of that type passing it the string returned by the query. (HINT: > if your python type has a _quote() function, then pyPgSQL will use it to > quote the value when it is used in a query). Right now, integrating > that type into pyPgSQL is not easy, but can be done. pyPgSQL version 3 > will have a way to register user defined types so that pyPgSQL will do > the right thing with it. Thank you. If I comprehend the explanation, the bottom line is that I must parse that raw string in order to get the data out of it. Creating a matching python type hides those machinations from the rest of the program but the gory work must still be done. Correct? Michael |