Using the DB environment in Python query as well