[python-bugzilla] Fwd: Complex Query Support

Arun Babu Neelicattu abn at redhat.com
Thu Nov 13 03:22:24 UTC 2014


MC; asking the obvious here but does [1] work via the web interface? As Cole pointed out, this is mostly to do with the instance.

I tried the following on landfill,

$ bugzilla query --from-url="https://landfill.bugzilla.org/bugzilla-4.4-branch/buglist.cgi?f1=bug_id&f2=alias&f3=cf_free_text&o1=greaterthan&o2=notsubstring&o3=regexp&query_format=advanced&v1=41000&v2=-&v3=%5E%24"
Server error: <Fault 108: "Can't use cf_free_text as a field name.">

$ bugzilla query --from-url="https://landfill.bugzilla.org/bugzilla-4.4-branch/buglist.cgi?f1=bug_id&f2=alias&o1=greaterthan&o2=notsubstring&query_format=advanced&v1=41000"
--snip results--

So stock bugzilla should work file with that query (the custom field issue seems to be independent), so I suspect your instance will need to be looked at. 

That being said, you could try using a saved search by passing in the savedsearch or savedsearch_sharer_id parameter when building the query as a workaround.

hth

-arun

[1] https://bugzilla.local/query.cgi?bug_status=New&bug_status=Accepted&bug_status=Reopened&f1=cf_custom_field_here&f2=bug_id&f3=alias&o1=regexp&o2=greaterthan&o3=notsubstring&query_format=advanced&v1=
^%24&v2=410000&v3=-

----- Original Message -----
> From: "Mildred Clarke" <gargoyle.python at gmail.com>
> To: "Cole Robinson" <crobinso at redhat.com>
> Cc: python-bugzilla at lists.fedorahosted.org
> Sent: Thursday, November 13, 2014 3:37:08 AM
> Subject: Re: [python-bugzilla] Fwd: Complex Query Support
> 
> Thanks for the reply on this issue. I've tried the "bugzilla" command line
> with --from-url option and the results are basically the same. At this
> point it looks like I will need to perform the advanced query from the Web
> UI, export the result set to CSV file, then import into my script for
> processing which is not ideal. It's workable, but not ideal.
> 
> Can anyone think of a better option / workaround to obtain an "advanced
> query" result set ?
> 
> Thanks
> 
> MC
> 
> On Wed, Nov 12, 2014 at 8:18 AM, Cole Robinson <crobinso at redhat.com> wrote:
> 
> > On 11/12/2014 11:12 AM, Mildred Clarke wrote:
> >
> >> All,
> >>
> >> The python-bugzilla implementation is great but I have one issue that I
> >> cannot
> >> seem to find resolution on. Was hoping that someone here could shed some
> >> light
> >> on the situation. I have attempted a few different ways and upon review
> >> of the
> >> source I don't think* what I am attempting to do is supported in the
> >> version I
> >> am using (1.1.0)
> >>
> >> When I attempt to build a complex query, the url_to_query method returns a
> >> dictionary object that appears to contain the appropriate values. However,
> >> when attempting to query the remote bugzilla instance an error message is
> >> displayed and no results are returned.  I believe this is due to the use
> >> of
> >> the "advanced" query format. The error message is complaining about the
> >> use of
> >> "v1" and sometimes "o2". Is it the use of Regex ? Is it my bugzilla
> >> instance ?
> >>
> >> Message and code snips below.
> >>
> >> --- Error Message ---
> >> Fault: <Fault 53: 'v1 is not a valid parameter for the
> >> Bugzilla::Bug::match
> >> function.'>
> >>
> >> --- Error Message ---
> >> Fault: <Fault 53: 'o2 is not a valid parameter for the
> >> Bugzilla::Bug::match
> >> function.'>
> >>
> >>
> >> --- CODE SNIP ---
> >> q_url="https://bugzilla.local/query.cgi?bug_status=New&bug_
> >> status=Accepted&bug_status=Reopened&f1=cf_custom_field_
> >> here&f2=bug_id&f3=alias&o1=regexp&o2=greaterthan&o3=
> >> notsubstring&query_format=advanced&v1=^%24&v2=410000&v3=-"
> >>
> >> Returns the values in a dictionary with this command --
> >> bz.url_to_query(q_url)
> >>
> >> {'bug_status': ['New', 'Accepted', 'Reopened'],
> >>   'f1': 'cf_custom_field_here',
> >>   'f2': 'bug_id',
> >>   'f3': 'alias',
> >>   'o1': 'regexp',
> >>   'o2': 'greaterthan',
> >>   'o3': 'notsubstring',
> >>   'query_format': 'advanced',
> >>   'v1': '^$',
> >>   'v2': '410000',
> >>   'v3': '-'}
> >>
> >> This is the actual code that will produce the error message. bz is my
> >> bugzilla
> >> connection.
> >> """ bz.query(bz.url_to_query(q_url)) """. As you can see, I am using the
> >> "advanced" formatting.  If I don't include the "f*, v*, o*" parameters
> >> queries
> >> return a result set.
> >>
> >> Let me know if you need more details to help figure out this issue.
> >>
> >> Thanks
> >>
> >> Mildred.
> >>
> >
> > The query_format=advanced support is a bugzilla.redhat.com custom
> > extension, so probably doesn't work for your local bugzilla instance. There
> > was some talk at one point of extending upstream bugzilla to support
> > something similar, but AFAICT that doesn't exist yet.
> >
> > - Cole
> >
> >
> 
> _______________________________________________
> python-bugzilla mailing list
> python-bugzilla at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/python-bugzilla
> 


More information about the python-bugzilla mailing list