handle different cursors for SQLAlchemy 0.5.* and 0.9.6

use namespace for import
Merge pull request #5392 from yuyiguo/DBFormatter

handle different cursors for SQLAlchemy 0.5.* and 0.9.6