Fixing AttributeError for db cursor object.