Jump to content

Create/update/get task in the same session


Remus Avram

Recommended Posts

If we create a task, assignee a user to the task and get the assigned user in the same session, it doesn't return the assigned user.

ftrack_task = session.query("Task where id is '{0}'".format(task_id))
assert len(ftrack_entity['assignments']) == 0
session.create('Appointment', {
 'resource': ftrack_user,
 'context_id': ftrack_task,
 "type": "assignment"}
 )
session.commit()
assert len(ftrack_task['assignments']) > 0
ftrack_task = session.query("Task where id is '{0}'".format(task_id))
assert len(ftrack_task['assignments']) > 0

 

Link to comment
Share on other sites

Hi Remus,

that is the cache kicking in. We will try to solve this longer term, for now it is important that you query any attribute that you want to be fetched from the server like:

ftrack_task = session.query("select assignments from Task where id is '{0}'".format(task_id))

Its either that of clearing the cache.

Link to comment
Share on other sites

  • 2 months later...

Hi @Björn Rydahl

are there any updates regarding this problem?

We have it in multiple locations and it's difficult to find all the time workarounds, and somethings is really confusing (most cases when we are running actions on the ftrack server which use one session of ftrack_api).

Tested on:

ftrack serve: 3.3.40

ftrack_api: 1.1.0

Link to comment
Share on other sites

  • 4 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...