From 77d6d31542ab2365f218d7305309d6c3468a36dc Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 1 Mar 2009 20:24:02 +0000 Subject: - Added PGUuid and PGBit types to sqlalchemy.databases.postgres. [ticket:1327] - Refection of unknown PG types won't crash when those types are specified within a domain. [ticket:1327] - executemany() in conjunction with INSERT..RETURNING is documented as undefined by psycopg2. --- lib/sqlalchemy/databases/postgres.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/databases/postgres.py') diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 8caadfaf8..038a9e8df 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -193,6 +193,14 @@ class PGBoolean(sqltypes.Boolean): def get_col_spec(self): return "BOOLEAN" +class PGBit(sqltypes.TypeEngine): + def get_col_spec(self): + return "BIT" + +class PGUuid(sqltypes.TypeEngine): + def get_col_spec(self): + return "UUID" + class PGArray(sqltypes.MutableType, sqltypes.Concatenable, sqltypes.TypeEngine): def __init__(self, item_type, mutable=True): if isinstance(item_type, type): @@ -283,6 +291,8 @@ ischema_names = { 'real' : PGFloat, 'inet': PGInet, 'cidr': PGCidr, + 'uuid':PGUuid, + 'bit':PGBit, 'macaddr': PGMacAddr, 'double precision' : PGFloat, 'timestamp' : PGDateTime, @@ -527,6 +537,7 @@ class PGDialect(default.DefaultDialect): elif attype == 'timestamp without time zone': kwargs['timezone'] = False + coltype = None if attype in ischema_names: coltype = ischema_names[attype] else: @@ -540,8 +551,6 @@ class PGDialect(default.DefaultDialect): # It can, however, override the default value, but can't set it to null. default = domain['default'] coltype = ischema_names[domain['attype']] - else: - coltype = None if coltype: coltype = coltype(*args, **kwargs) -- cgit v1.2.1