docs: def _query(cmd):
      """ Create the grammar for a scan/query """
      action = upkey(cmd).setResultsName("action")
      consist = upkey("consistent").setResultsName("consistent")
      order_by = (Suppress(upkey("order") + upkey("by")) + var).setResultsName("order_by")
      ordering = (upkey("desc") | upkey("asc")).setResultsName("order")
      save = (Suppress(upkey("save")) + filename).setResultsName("save_file")
  
      return (
          action
          + Optional(consist)
          + selection
          + from_
          + table
          + Optional(keys_in | where)
          + Optional(using)
          + Optional(limit)
          + Optional(scan_limit)
          + Optional(order_by)
          + Optional(ordering)
          + Optional(throttle)
          + Optional(save)
      )