From 2bbf09bfdedb2ddc710999f2941bde594d339274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 11 Sep 2012 16:17:55 +0200 Subject: support for reflecting PostGIS columns --- lib/sqlalchemy/dialects/postgresql/base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index c615db85d..6070f964f 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: -- cgit v1.2.1