def get_sortkey(table):
    """Get a field to sort by
    """
    # Just pick the first column in the table in alphabetical order.
    # Ideally we would get the primary key from bcdc api, but it doesn't
    # seem to be available
    wfs = WebFeatureService(url=bcdata.OWS_URL, version="2.0.0")
    return sorted(wfs.get_schema("pub:" + table)["properties"].keys())[0]
Get a field to sort by