Jump to content

Length of query result ?


Recommended Posts

Hi All, 

I am trying to return a query :=

p = session.query('select id,name from Project where name is "projname"')

Certain projnames return a result id/name but others don't ?

Is there a limit to a query length ?

or something else I may be missing ?



Link to comment
Share on other sites

Hi @Rory

If you haven't I'd suggest having a read on the general syntax about the query system here.
And look into details about the query projections to have a better idea on how to optimisatise the queries.

In regard of your question:
> Certain projnames return a result id/name but others don't ?

Projects (as well as any other ftrack entity type) do have some values set and available by default and defined by the server schema, such as id and others.
Name can be there or not , but really depends on the entity type (eg: AssetVersion won't, Project will )

The easier way to see what fields are available is to get the keys() off the entity you just got back from the query eg:

a_project = session.query('Project').first() # return only the first project found

which will return all the available fields available for the project:

> ['created_at', 'managers', 'calendar_events', 'color', '_link', 'full_name', 'disk', 'children', 'timelogs', 'end_date', 'parent_id', 'created_by', 'disk_id', 'id', 'user_security_role_projects', 'start_date', 'project_schema', 'metadata', 'status', 'scopes', 'project_schema_id', 'parent', 'descendants', 'thumbnail_id', 'review_sessions', 'appointments', 'link', 'is_private', 'assets', 'is_global', 'name', 'notes', 'thumbnail', 'assignments', 'thumbnail_url', 'allocations', 'custom_attributes', 'created_by_id', 'root', 'context_type']

Hope it helps.

Link to comment
Share on other sites

Thanks Lorenzo - 

Certainly have worked through those - 

My problem seems to not have to do with the actual query itself because when I do the following :


projects = session.query('Project')

for p in projects:


Not all the projects are returned .... ?

So the one that I am trying to query is not in the returned list .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...