JIRA query for issues without parents - sql

I'm using a JIRA instance for which I'm not the admin, so I don't have the option of installing plugins. I'm trying to filter to find issues in a particular project that don't have a parent (aren't sub-tasks of something else), but I can't figure out a good way to do so. The following query returns issues with a particular parent with the ID 84, but I'm not sure how to tweak it to get issues with no parent:
project = FOO AND Status = Open AND parent = FOO-84

It doesn't seem to be possible since doing "parent = null" or "" will tell you that the parent field doesn't support empty value search.
However, to get a list of top level issues you can use the issueType field this way:
project = FOO AND Status = Open AND issuetype in standardIssueTypes()
To get a list of subtasks:
project = FOO AND Status = Open AND issuetype in subTaskIssueTypes()

For anyone searching, this is my JQL:
issuetype = Task AND issueLinkType != "Child to" ORDER BY created DESC

The above didn't work for me. Here is another way to get un-parented tasks:
issuetype in StandardIssueTypes() AND parent is null
Here is how to get un-parented subtasks.
issuetype in subTaskIssueTypes() AND parent is null
You can filter our 'Done' statuses by adding the below to any JQL
AND status NOT IN (Done)

For anyone who is still looking for a working JQL that only displays issues that have no parent yet:
issuetype in StandardIssueTypes() AND issueLinkType != parent ORDER BY created DESC
You can of course replace in StandardIssueTypes() by a specific issue type like a task. The query will then be:
issuetype = Task AND issueLinkType != parent ORDER BY created DESC
If you don't want to order, please remove:
'ORDER BY created DESC'

Related

Dynamic filter based on boolean foreign value

Not being a SQL expert, and discovering Metabase here, so please be kind;
I'm working on a dashboard that would offer a specific filter.
For the sakes of clarity, I'll describe my simplified case.
I have some projects in my DB. Some are "active", some aren't. I would like to create a filter that provides only a selection of those "active".
Because my project settings are in a different table than the project itself, here's basically how I've tried to create this filter:
SELECT "public"."Project"."status" AS "status", "ProjectSettings"."name" AS "ProjectSettings__name"
FROM "public"."Project"
LEFT JOIN "public"."ProjectSettings" "ProjectSettings" ON "public"."Project"."id" = "ProjectSettings"."projectId"
WHERE (
"ProjectSettings"."active" = 'ACTIVE')
AND "ProjectSettings"."name" = {{Project}}
What I was expecting to happen here is that only the filtered active projects were made available in my filter. Without any luck so far.
Thanks for your suggestions :)
I assume {{Projects}} is a collection of multiple projects. Is that correct? if so, you should use an IN clause in the criterion.
WHERE (
"ProjectSettings"."active" = 'ACTIVE')
AND "ProjectSettings"."name" IN {{Project}}
the listing {{Projects}} should then be in the form 'project1','project2','project3',...

How to get specific assignee of a story, subtask with a specific summary in JIRA?

I am using JIRA version v8.5.9, where I am running the following query in its search option.
issuetype = "Sub task" AND assigned == 'xyz' and summary = '16.4'
Where xyz is a user. Basically what I am trying to achieve is: I am looking for all stories, sub-tasks whose assignee is xyz user along with its summary should contain 16.4 in it. When I am running this query it's not giving me any results. Any help is greatly appreciated.
With your shown attempts, could you please try following query.
(issuetype = "Story" OR issuetype = "Sub task") AND assignee = 'xyz' AND summary ~ "16.4"
Explanation:
First thing first you need to use OR condition for having stories and sub tasks both to be catch here.
Then you need to use ~ operator to search for string, since you mentioned you could have other than 16.4 string then we can't use = here.
Try using the contains ~ operator:
issuetype = "Sub task" AND assigned == 'xyz' and summary ~ '*16.4*'

Solr subquery merging issue

I have an issue to search with SOLR in following scenario,
I'd like to get all products within my favorite tag, categories and user. I want all products which created by my favorite user without any filter but products from favorite tag or categories must be filtered with in a selected location. I have tried as follows,
http://www.example.com:8983/solr/collection1/select?rows=10&start=0&wt=json&indent=true&sort=event_start_date asc&q=status:1 AND event_start_date:[2015-04-23T21:38:00Z TO *] AND ( tags:5539d77455061a650f96c67e OR category1_id:53d16fb28066a12606bbb5f2 OR category2_id:53d16fb28066a12606bbb5f2&fq={!geofilt d=40.2335}&pt=9.9312328,76.26730409999999&sfield=latlng) OR ( user_id:5465da1dc54d3c2a15000000 )
But its not working. Any body help me to find what's wrong with my query?
First of all you have a fq (filterquery clause) inside your query clause (check parenthesis) which is wrong.
fq={!geofilt d=40.2335}&pt=9.9312328,76.26730409999999&sfield=latlng
You can try things like puting the geofilt filter query OUTSIDE your main query with tests so it will be skipped if...
http://www.example.com:8983/solr/collection1/select?rows=10&start=0&wt=json&indent=true&sort=event_start_date asc&q=status:1 AND
event_start_date:[2015-04-23T21:38:00Z TO *] AND
(tags:5539d77455061a650f96c67e OR
category1_id:53d16fb28066a12606bbb5f2 OR
category2_id:53d16fb28066a12606bbb5f2) OR
(user_id:5465da1dc54d3c2a15000000)
&fq=user_id:5465da1dc54d3c2a15000000 OR
{!geofilt pt=9.9312328,76.26730409999999 sfield=latlng d=40.2335}
If user_id is 5465da1dc54d3c2a15000000 then the filterquery is already true so location part is skipped.

order_by() method not working in peewee

I am using a SQLite backend with a simple show - season - episode schema:
class Show(BaseModel):
name = CharField()
class Season(BaseModel):
show = ForeignKeyField(Show, related_name='seasons')
season_number = IntegerField()
class Episode(BaseModel):
season = ForeignKeyField(Season, related_name='episodes')
episode_number = IntegerField()
and I would need the following query :
seasons = (Season.select(Season, Episode)
.join(Episode)
.where(Season.show == SHOW_ID)
.order_by(Season.season_number.desc(), Episode.episode_number.desc())
.aggregate_rows())
SHOW_ID being the id of the show for which I want the list of seasons.
But when I iterate over the query with the following code :
for season in seasons:
for episode in season.episodes:
print(episode.episode_number)
... I get something which is not ordered at all, and which does not even follow the order I would get without using order_by(), i.e. the insertion order.
I activated the debug logs to see the outgoing query, and the query does contain the ORDER BY clause, and manually applying it returns the proper descending order.
I am new to peewee, and I have seen so many examples making use of a join() combines with an order_by(), but I can still not find out what I am doing wrong.
This was due to a bug in the processing of nested collections in the aggregate query result wrapper.
The github issue is: https://github.com/coleifer/peewee/issues/519
The fix has been merged here: https://github.com/coleifer/peewee/commit/ec0e87f1a480695d98bf1f0d7f2e63aed8dfc440
So, to get the fix you'll need to either clone master or wait til the next release which should be in the next week or two (2.4.7).

Rally custom grid with ((Parent = null) or (Parent.Name = 'xxxx'))

Can you create a custom User Story grid in Rally with the following query?
(((Parent = null) AND (Owner.Name = "dummy.name#email.com")) OR ((Parent.Name contains "Example") AND (Owner.Name = "dummy.name#email.com")))
Every time I try to do this it only returns results for the second part of the query. It seems like it cannot combine the Parent = null and the Parent.Name contains "Example".
Thanks for any feedback! I know that we could create two grids, but it would be nice to combine it into one.
This looks like a bug to me. Ignoring the owner portion of the query and taking just the Parent portions, per the title of your question: ((Parent = null) or (Parent.Name = 'xxxx')), it seems that I am also always seeing results that match the latter condition. If I switch the order, I get Parent-less stories. I'd recommend submitting a Case to Rally Support - rallysupport#rallydev.com - they can get this filed with the Rally developers.