Saved Searches#

After defining search conditions, a search can be saved for later use allowing you to quickly filter your Pipelines, Fragments, Jobs, Job Templates & Draft Runs without having to define a new search query. More information on SAQL Saved Searches can be found in the StreamSets Platform Documentation.

Retrieving Saved Searches#

In the UI, you can retrieve your Saved searches by selecting ‘Saved Searches’ from the additional options menu:


Retrieving saved searches using the SDK can be done by referencing the following properties of a streamsets.sdk.ControlHub instance:

  1. Saved searches pertaining to Pipelines can be accessed via the streamsets.sdk.ControlHub.saql_saved_searches_pipeline attribute

  2. Saved searches pertaining to Fragments can be accessed via the streamsets.sdk.ControlHub.saql_saved_searches_fragment attribute

  3. Saved searches pertaining to Job Instances can be accessed via the streamsets.sdk.ControlHub.saql_saved_searches_job_instance attribute

  4. Saved searches pertaining to Job Templates can be accessed via the streamsets.sdk.ControlHub.saql_saved_searches_job_template attribute

  5. Saved searches pertaining to Draft Runs can be accessed via the streamsets.sdk.ControlHub.saql_saved_searches_draft_run attribute

If you wanted to retrieve and store all of the various saved searches for each supported object, you could do so using the following:


You can also filter the saved searches by specifying attributes like name, creator or type. For example, retrieving all saved searches pertaining to Job Templates that are marked as a favorite would look like the following:

job_template_favorite_searches = sch.saql_saved_searches_job_template.get_all(favorite=True)

Marking a Saved Search as a Favorite#

In the UI, marking a search as a favorite entails going into your ‘Saved Searches’, finding the desired search and selecting the star icon:


To mark a search as a favorite in the SDK, retrieve the streamsets.sdk.sch_models.SAQLSearch instance you wish to mark as a favorite and pass it to the streamsets.sdk.ControlHub.mark_saql_search_as_favorite() method. Similarly, to un-mark a search as a favorite, you would pass the streamsets.sdk.sch_models.SAQLSearch instance you wish to un-mark into the streamsets.sdk.ControlHub.mark_saql_search_as_favorite() method:


To check if a streamsets.sdk.sch_models.SAQLSearch instance is currently a favorite or not, reference the instance’s favorite attribute which will return True or False: