On Thursday 20 December 2007 07:10:59 am Ed Leafe wrote: > On Dec 20, 2007, at 4:44 AM, Wolfgang Keller wrote: > > I am basically defining custom types for everything, so that I don't > > have to use "native" datatypes in the table definitions: > > Curious: have you ever worked with any of the ORM products, such as > SQLAlchemy or SQLObject? If so, how do they handle these custom types?
http://www.sqlalchemy.org/docs/04/types.html > > If you were to query a table with these custom columns directly > using the dbapi, using something like psycopg, what does the > 'description' attribute of the dbapi cursor object return? Using CREATE DOMAIN unsigned_smallint AS SMALLINT CHECK(VALUE >= 0); I created a field which was assigned the user data type "unsigned_smallint": For the field in question cursor.description returns: ('newtype', 21, 1, 2, None, None, None)) Where the "typecode" is 21. "21" points back to the data type of "int2" in the pg_type table. Looks like psycopg can find the information required. If I changed the way I determine the field data types dbPostgres.py might be a bit more flexible. CREATE TYPE cris_datetime_type AS ( datetime TIMESTAMP(0) WITHOUT TIME ZONE nanoseconds NUMERIC(9, 9)) ('mytypetest', 1824148, 0, -1, None, None, None) As you would expect '1824148' points to nothing in the pg_type table. I don't know as of now how it works. I will ask on the psycopg list. -- John Fabiani _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
