nodes: 0, module; 1, function_definition; 2, function_name:get_sortkey; 3, parameters; 4, block; 5, identifier:table; 6, expression_statement; 7, comment:# Just pick the first column in the table in alphabetical order.; 8, comment:# Ideally we would get the primary key from bcdc api, but it doesn't; 9, comment:# seem to be available; 10, expression_statement; 11, return_statement; 12, comment:"""Get a field to sort by
      """; 13, assignment; 14, subscript; 15, identifier:wfs; 16, call; 17, call; 18, integer:0; 19, identifier:WebFeatureService; 20, argument_list; 21, identifier:sorted; 22, argument_list; 23, keyword_argument; 24, keyword_argument; 25, call; 26, identifier:url; 27, attribute; 28, identifier:version; 29, string:"2.0.0"; 30, attribute; 31, argument_list; 32, identifier:bcdata; 33, identifier:OWS_URL; 34, subscript; 35, identifier:keys; 36, call; 37, string:"properties"; 38, attribute; 39, argument_list; 40, identifier:wfs; 41, identifier:get_schema; 42, binary_operator:"pub:" + table; 43, string:"pub:"; 44, identifier:table
code: 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]