Use hasattr to find missing relations

Some relations, e.g. association_proxy, can't be found by SQLAlchemy
introspection. So it should be better to check missing relation by its
actual existence, not by SQLAlechemy introspection.