Postgres Use Variable In String Python Definition Function