client.search.list_queries

A method of the Search endpoint.

list_queries(*, search_string: str = None, database_id: int = None, credential_id: int = None, author_id: int = None, archived: bool = None, state: List[str] = None, started_before: str = None, started_after: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None) ListResponse | PaginatedResponse

Search queries that are not hidden

API URL: GET /search/queries

import civis
client = civis.APIClient()
response = client.search.list_queries(...)
Parameters:
search_stringstr, optional

Space delimited search terms for searching queries by their SQL. Supports wild card characters “?” for any single character, and “*” for zero or more characters.

database_idint, optional

The database ID.

credential_idint, optional

The credential ID.

author_idint, optional

The author of the query.

archivedbool, optional

The archival status of the requested item(s). Defaults to false.

stateList[str], optional

The state of the last run. One or more of queued, running, succeeded, failed or cancelled.

started_beforestr, optional

An upper bound for the start date of the last run.

started_afterstr, optional

A lower bound for the start date of the last run.

limitint, optional

Number of results to return. Defaults to 10. Maximum allowed is 50.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to last_run_started_at. Must be one of: last_run_started_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.

iteratorbool, optional

If True, return a generator (specifically, a civis.PaginatedResponse object) to iterate over all responses. Use it when more results than the maximum allowed by ‘limit’ are needed. When True, ‘page_num’ is ignored. If False, return a civis.ListResponse object (= a list of civis.Response objects), whose size is determined by ‘limit’. Defaults to False.

Returns:
civis.ListResponse | civis.PaginatedResponse
  • idint

    The query ID.

  • databaseint

    The database ID.

  • credentialint

    The credential ID.

  • sqlstr

    The SQL executed by the query.

  • author_idint

    The author of the query.

  • archivedbool

    The archival status of the requested item(s).

  • created_at : str (time)

  • updated_at : str (time)

  • last_runcivis.Response
    • id : int

    • statestr

      The state of the run. One of queued, running, succeeded, failed or cancelled.

    • started_atstr (time)

      The time that the run started.

    • finished_atstr (time)

      The time that the run completed.

    • errorstr

      The error message for this run, if present.