Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:34:14+00:00 2026-06-18T05:34:14+00:00

I am using pyral, the Rally python SDK , I format my query string

  • 0

I am using pyral, the Rally python SDK, I format my query string with a tuple, but it appears that any time I have more than two terms it fails. Here is my test code:

import pyral

rally = pyral.Rally('rally1.rallydev.com', 'user@example.com', 'password')

user = rally.getUserInfo(name='User Name').pop(0)
wksp = rally.getWorkspace()
proj = rally.getProject()

print user.FirstName, user.LastName
print wksp.Name
print proj.Name

queryStrings = (
('State != "Closed"', 'Owner = ' + user.ref),
('State != "Fixed"', 'Owner = ' + user.ref),
('State != "Closed"', 'State != "Fixed"'),
('State != "Closed"', 'State != "Fixed"', 'Owner = ' + user.ref),
('State != Closed', 'State != Fixed', 'State != Submitted'),
('State != Fixed', 'ScheduleState != Tested'),
('State != Fixed', 'Owner = ' + user.ref, 'ScheduleState != Tested'),
)

for query in queryStrings:
    print "++++++++++++++++++++++++++++++++++++++++++"
    print "Query:",query
    defects = rally.get("Defect", True, query=query)
    print "Number of results:",defects.resultCount
    print "Errors:", defects.errors
    print

And here is the resulting output

User Name
A Workspace
Web Project
++++++++++++++++++++++++++++++++++++++++++
Query: ('State != "Closed"', u'Owner = user/1234567890')
QUERYJUNK: ((State != "Closed") AND (Owner = user/1234567890))
Number of results: 25
Errors: []

++++++++++++++++++++++++++++++++++++++++++
Query: ('State != "Fixed"', u'Owner = user/1234567890')
QUERYJUNK: ((State != "Fixed") AND (Owner = user/1234567890))
Number of results: 89
Errors: []

++++++++++++++++++++++++++++++++++++++++++
Query: ('State != "Closed"', 'State != "Fixed"')
QUERYJUNK: ((State != "Closed") AND (State != "Fixed"))
Number of results: 149
Errors: []

++++++++++++++++++++++++++++++++++++++++++
Query: ('State != "Closed"', 'State != "Fixed"', u'Owner = user/1234567890')
QUERYJUNK: ((State != "Closed") AND (State != "Fixed") AND (Owner = user/1234567890))
Number of results: 0
Errors: [u'Could not parse: Error parsing expression -- expected ")" but saw "AND"       instead.']

++++++++++++++++++++++++++++++++++++++++++
Query: ('State != Closed', 'State != Fixed', 'State != Submitted')
QUERYJUNK: ((State != Closed) AND (State != Fixed) AND (State != Submitted))
Number of results: 0
Errors: [u'Could not parse: Error parsing expression -- expected ")" but saw "AND" instead.']

++++++++++++++++++++++++++++++++++++++++++
Query: ('State != Fixed', 'ScheduleState != Tested')
QUERYJUNK: ((State != Fixed) AND (ScheduleState != Tested))
Number of results: 247
Errors: []

++++++++++++++++++++++++++++++++++++++++++
Query: ('State != Fixed', u'Owner = user/1234567890', 'ScheduleState != Tested')
QUERYJUNK: ((State != Fixed) AND (Owner = user/1234567890) AND (ScheduleState !=     Tested))
Number of results: 0
Errors: [u'Could not parse: Error parsing expression -- expected ")" but saw "AND" instead.']

The QUERYJUNK is the output of the query string built by the Rally SDK itself, before it sends it to the rally service.

EDIT:

Since this is a bug in the SDK itself per Kyle’s answer, I created a work around in my script until the SDK can be fixed.

def buildQueryString(querySequence):
if type(query) in [types.ListType, types.TupleType]:
    seq = ["(%s)" % (s,) for s in querySequence]
    qs = "%s" % seq.pop(0)
    for qt in seq:
        qs = "(%s AND %s)" % (qs, qt)
    print "QS:",qs
    return qs

return querySequence

I then pass this string generated into the API, and everything appears to work now. It looks like the API also supports dictionaries for the query parameter, but since it was undocumented, and I don’t need it, I did not create a work around for that case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:34:15+00:00Added an answer on June 18, 2026 at 5:34 am

    This appears to be a bug in pyral generating query strings with more than 2 clauses.

    Is currently:

    ((State != Closed) AND (State != Fixed) AND (State != Submitted))
    

    Should be:

    (((State != Closed) AND (State != Fixed)) AND (State != Submitted))
    

    We will work to get this fixed soon and open source it on github so the community can better address issues like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using import datetime in python, is it possible to take a formatted time/date string
Using ember 1.0.0-pre3 I have a little app that has this code: window.App =
Using python and the gi.repository module, I am trying to call Gdk.threads_add_idle , but
I am using the Python Toolkit for Rally REST API to update defects on
Using SSRS 2008 R2 I have a background process that dynamically generates RDL for
Using Python, I'm trying to connect to my AppEngine app's remote_api handler, but I
Using CRM 4, I have an entity form that contains a tab with an
Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
Using php, what is the regex to match an exact string. Say we have
Using CI for the first time and i'm smashing my head with this seemingly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.