summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉric Lemoine <eric.lemoine@gmail.com>2012-09-11 16:17:55 +0200
committerÉric Lemoine <eric.lemoine@gmail.com>2012-09-11 16:17:55 +0200
commit2bbf09bfdedb2ddc710999f2941bde594d339274 (patch)
tree7b1bdc9144fa5e437830fdb3661aab9da62776e7
parent7fa59a431e1a66bfd383fc45cee5b0196c645678 (diff)
downloadsqlalchemy-2bbf09bfdedb2ddc710999f2941bde594d339274.tar.gz
support for reflecting PostGIS columns
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py10
1 files changed, 6 insertions, 4 deletions
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: