Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-4766

Allow querying for all reports with type = any

    XMLWordPrintable

Details

      • Report filter type = "any" omits a filter of report type
      • Document how to query for all report types
    • Ghost
    • ghost-19.05.2021, ghost-19.05.2021, ghost-2.06.2021
    • New Feature
    • Hide
      A new way of querying for all reports was introduced. All reports are queried by including type = "any" in the query body.

      Ex: AST: curl -X POST http://HOST:PORT/pdb/query/v4 -H 'Content-Type:application/json' -d '{"query": [ "from", "reports", [ "extract", [ ], [ "=", "type", "any" ] ] ]}'

      PQL: curl -X POST http://HOST:PORT/pdb/query/v4 -H 'Content-Type:application/json' -d '{"query": "reports[] { type = \"any\"}"}'

      An improvement for query validation was also made: if an "and" or "or" is provided without any clauses the error message is more helpful.

      Ex: '{"query": [ "from", "reports", [ "extract", [ ], ["and"] ] ]}' error with:
       
       'and' takes at least one argument, but none were suppllied

      vs before it showed the error from translating the query to SQL :

      2021-05-24 09:55:29.460 EEST [40624] ERROR: syntax error at or near ")" at character 2199
      Show
      A new way of querying for all reports was introduced. All reports are queried by including type = "any" in the query body. Ex: AST: curl -X POST http://HOST:PORT/pdb/query/v4 -H 'Content-Type:application/json' -d '{"query": [ "from", "reports", [ "extract", [ ], [ "=", "type", "any" ] ] ]}' PQL: curl -X POST http://HOST:PORT/pdb/query/v4 -H 'Content-Type:application/json' -d '{"query": "reports[] { type = \"any\"}"}' An improvement for query validation was also made: if an "and" or "or" is provided without any clauses the error message is more helpful. Ex: '{"query": [ "from", "reports", [ "extract", [ ], ["and"] ] ]}' error with:    'and' takes at least one argument, but none were suppllied vs before it showed the error from translating the query to SQL : 2021-05-24 09:55:29.460 EEST [40624] ERROR: syntax error at or near ")" at character 2199
    • Needs Assessment

    Description

      Currently querying for all reports looks like

      reports[] {
        type is not null
      }
      

      which is a bit opaque about how to query for all reports.

      It would be better UX and produce a more efficient query to support

      reports[] {
        type = "any"
      }
      

      Attachments

        Issue Links

          Activity

            People

              oana.tanasoiu Oana Tanasoiu
              austin.blatt Austin Blatt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support