Incorporate SQL queries into Python