Added psycopg2.extensions.adapt() to proper quote input into sql