Tilt Posted January 16, 2017 Report Share Posted January 16, 2017 I'm having trouble understanding the use of "has" and "any" as it is described in the api docs at http://ftrack.rtd.ftrack.com/en/stable/developing/api/query_syntax.html#filtering-on-relationships The example for "has" is: select id from Note where author has (first_name is "Jane" and last_name is "Doe") and the text states that writing that query without "has" wouldn't have the desired effect of returning notes from Jane Doe. But why is that? The way I would write this query without "has" would be: select id from Note where author.first_name is "Jane" and author.last_name is "Doe" How would this query return notes by "Jane Smith" or "John Doe"? I'm having trouble following along. I now I could play around with queries on our server but I don't really know what a correct result would look like so I'm asking this on the forum instead :-) Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted January 17, 2017 Report Share Posted January 17, 2017 You're absolutely right. The example is wrong and I will update it. What is said in the example is true for non-scalar relations like metadata or children, e.g: Task where metadata any (key is "foo" and value is "bar") In this case using "any" guarantees that we're not getting tasks that have one metadata item with key "foo" and another metadata item with value "bar". We're looking for tasks with metadata items that have key "foo" and value "bar". Thanks for pointing this out! Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted January 17, 2017 Report Share Posted January 17, 2017 Here is the pull-request with a fix: https://bitbucket.org/ftrack/ftrack-python-api/pull-requests/164/backlog-query-filter-example-is-not/diff Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.