don't fall over for dialects that have discrepancies in table cols vs. index cols reported

Issue #3180 resolved
Mike Bayer repo owner created an issue

this is happening on oracle but we can just guard against this more fundamentally:

from sqlalchemy import create_engine, Table, MetaData, Integer
import mock

e = create_engine("sqlite://")
e.execute("""create table x (a integer, b integer)""")
e.execute("""create index x_i on x(a, b)""")

def mock_get_columns(self, connection, table_name, **kw):
    return [
        {"name": "b", "type": Integer, "primary_key": False}
    ]

with mock.patch.object(e.dialect, "get_columns", mock_get_columns):
    m = MetaData()
    t = Table('x', m, autoload_with=e)

Comments (5)

  1. Mike Bayer reporter
    • An adjustment to table/index reflection such that if an index reports a column that isn't found to be present in the table, a warning is emitted and the column is skipped. This can occur for some special system column situations as has been observed with Oracle. fixes #3180

    → <<cset ec840a6eea05>>

  2. Mike Bayer reporter
    • An adjustment to table/index reflection such that if an index reports a column that isn't found to be present in the table, a warning is emitted and the column is skipped. This can occur for some special system column situations as has been observed with Oracle. fixes #3180

    → <<cset 34c0aaeedaf9>>

  3. Ivan Smirnov

    Thanks, that looks great, should make it much easier for oracle / mssql users. It'll be a part of 0.9.8 update, right?

  4. Log in to comment