Schema reflection fails with Firebird and DEFAULT

Issue #1582 resolved
Former user created an issue

During schema reflection SQLAlchemy fails with AssertionError

Traceback (most recent call last):
  File "/tmp/sqla2.py", line 190, in <module>
    concentrate=False # Don't try to join the relation lines together
  File "/tmp/sqla2.py", line 132, in create_schema_graph
    metadata.reflect()
  File "/home/filip/tefnet/teferp/workspace/tefobjects/lib/python2.5/site-packages/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/schema.py", line 1733, in reflect
    Table(name, self, **reflect_opts)
  File "/home/filip/tefnet/teferp/workspace/tefobjects/lib/python2.5/site-packages/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/schema.py", line 108, in __call__
    return type.__call__(self, name, metadata, *args, **kwargs)
  File "/home/filip/tefnet/teferp/workspace/tefobjects/lib/python2.5/site-packages/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/schema.py", line 236, in __init__
    _bind_or_error(metadata).reflecttable(self, include_columns=include_columns)
  File "/home/filip/tefnet/teferp/workspace/tefobjects/lib/python2.5/site-packages/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/engine/base.py", line 1265, in reflecttable
    self.dialect.reflecttable(conn, table, include_columns)
  File "/mnt/tmp/tefnet/teferp/workspace/tefobjects/lib/python2.5/site-packages/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/databases/firebird.py", line 502, in reflecttable
    assert row['fdefault']('fdefault').upper().startswith('DEFAULT '), row
AssertionError: (u'DATAREJ                        ', 1, u'DATE                           ', None, 4, None, 0, ' DEFAULT CURRENT_DATE')

The problem is because 'DEFAULT' sometimes has whitespaces at the begining

Comments (5)

  1. Former user Account Deleted

    Ups.. sorry, I didn't notice that (only checked with 0.5.x svn). It would be nice to have it with 0.5.x because we probably won't be moving to 0.6 any time soon.

  2. Log in to comment