Class QueriesAPI


  • @Generated
    public class QueriesAPI
    extends Object
    These endpoints are used for CRUD operations on query definitions. Query definitions include the target SQL warehouse, query text, name, description, tags, parameters, and visualizations. Queries can be scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create.
    • Constructor Detail

      • QueriesAPI

        public QueriesAPI​(ApiClient apiClient)
        Regular-use constructor
      • QueriesAPI

        public QueriesAPI​(QueriesService mock)
        Constructor for mocks
    • Method Detail

      • create

        public Query create​(QueryPostContent request)
        Create a new query definition.

        Creates a new query definition. Queries created with this endpoint belong to the authenticated user making the request.

        The `data_source_id` field specifies the ID of the SQL warehouse to run this query against. You can use the Data Sources API to see a complete list of available SQL warehouses. Or you can copy the `data_source_id` from an existing query.

        **Note**: You cannot add a visualization until you create the query.

      • delete

        public void delete​(String queryId)
      • delete

        public void delete​(DeleteQueryRequest request)
        Delete a query.

        Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and they cannot be used for alerts. The trash is deleted after 30 days.

      • get

        public Query get​(GetQueryRequest request)
        Get a query definition.

        Retrieve a query object definition along with contextual permissions information about the currently authenticated user.

      • list

        public Iterable<Query> list​(ListQueriesRequest request)
        Get a list of queries.

        Gets a list of queries. Optionally, this list can be filtered by a search term.

      • restore

        public void restore​(String queryId)
      • restore

        public void restore​(RestoreQueryRequest request)
        Restore a query.

        Restore a query that has been moved to the trash. A restored query appears in list views and searches. You can use restored queries for alerts.

      • update

        public Query update​(QueryEditContent request)
        Change a query definition.

        Modify this query definition.

        **Note**: You cannot undo this operation.