reflect() exception when analyzing postgresql index

Issue #1355 resolved
Former user created an issue

sqlachemy's (0.5.2) reflect method bombs when trying to analyze the following Postgresql index:

Postgresql...

test=# CREATE TABLE freq (

test(# entr INT NOT NULL,

test(# rdng SMALLINT NULL,

test(# kanj SMALLINT NULL,

test(# kw SMALLINT NOT NULL);

CREATE TABLE

test=# CREATE UNIQUE INDEX freq_idx1 ON freq(entr,(coalesce(rdng,999)),(coalesce(kanj,999)),kw);

CREATE INDEX

Python...

from sqlalchemy import *

engine = create_engine('postgres://localhost/test')

meta = MetaData()

meta.reflect(bind=engine)

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "sqlalchemy\schema.py", line 1702, in reflect Table(name, self, reflect_opts) File "sqlalchemy\schema.py", line 113, in call return type.call(self, name, metadata, *args, kwargs) File "sqlalchemy\schema.py", line 239, in init autoload_with.reflecttable(self, include_columns=include_columns) File "sqlalchemy\engine\base.py", line 1265, in reflecttable self.dialect.reflecttable(conn, table, include_columns) File "sqlalchemy\databases\postgres.py", line 658, in reflecttable schema.Index(name, *[table.columnsc for c in columns], File "sqlalchemy\util.py", line 634, in getitem return self._datakey KeyError: u'pg_expression_2'

HTH, rurpy

Comments (3)

  1. Former user Account Deleted

    Never mind. Just realized 0.5.3 was released a couple days ago and seems to have fixed this problem. Sorry for the noise.

  2. Log in to comment