Compatibility for SQLAlchemy 0.8

The check for the parent field name failed for SQLAlchemy 0.8 and
a second test for that version was introduced. The code works for
both >=0.7.5 and >=0.8 versions now.