From: Éric Lemoine Date: Tue, 11 Sep 2012 14:17:55 +0000 (+0200) Subject: support for reflecting PostGIS columns X-Git-Tag: rel_0_8_0b1~156^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bbf09bfdedb2ddc710999f2941bde594d339274;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git support for reflecting PostGIS columns --- diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index c615db85d3..6070f964f8 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1483,7 +1483,7 @@ class PGDialect(default.DefaultDialect): for name, format_type, default, notnull, attnum, table_oid in rows: ## strip (5) from character varying(5), timestamp(5) # with time zone, etc - attype = re.sub(r'\([\d,]+\)', '', format_type) + attype = re.sub(r'\(.*\)', '', format_type) # strip '[]' from integer[], etc. attype = re.sub(r'\[\]', '', attype) @@ -1493,8 +1493,12 @@ class PGDialect(default.DefaultDialect): charlen = re.search('\(([\d,]+)\)', format_type) if charlen: charlen = charlen.group(1) + args = re.search('\((.*)\)', format_type) + if args: + args = tuple(args.group(1).split(',')) + else: + args = () kwargs = {} - args = None if attype == 'numeric': if charlen: @@ -1531,8 +1535,6 @@ class PGDialect(default.DefaultDialect): args = () elif charlen: args = (int(charlen),) - else: - args = () while True: if attype in self.ischema_names: