Fix some direct imports from sqlalchemy

Directly import sqlalchemy might result in some inconsistent
behaviors. It would bypass the db_backend configuration.

Change-Id: Ic07c5d9f4898add6629a296ee1dff22be0e75262
Merge "Fix some direct imports from sqlalchemy"