Update queries.py for schema 17.