Hello,
I`m trying to do something like this, but I get an error when try to create a CalendarEventResource. I want to create an event connected to a user
Here is my code:
CalendarEvent = session.create(
'CalendarEvent',
{
'name': 'TEST_PIPELINE',
'start': arrow.get('2021-08-25'),
'end': arrow.get('2021-08-31'),
}
)
session.commit()
user = session.query('User where username is "alima"').first()
event = session.create(
'CalendarEventResource',
{
'calendar_event_id': CalendarEvent['id'],
'resource_id ': user['id']
}
)
session.commit()
And here is the error:
Traceback (most recent call last):
File "/mnt/be-fs/home/alima/Documents/DEV/misc/ftrack/creating_booking.py", line 29, in <module>
session.commit()
File "/mnt/be-fs/rnd/pipe/dev/users/alima/ada/aux/libs/python/global/ftrack_api/session.py", line 1260, in commit
result = self.call(batch)
File "/mnt/be-fs/rnd/pipe/dev/users/alima/ada/aux/libs/python/global/ftrack_api/session.py", line 1654, in call
raise ftrack_api.exception.ServerError(error_message)
ftrack_api.exception.ServerError: Server reported error: OperationalError((MySQLdb._exceptions.OperationalError) (1048, "Column 'resource_id' cannot be null") [SQL: u'INSERT INTO calendar_event_resource (calendar_event_id, resource_id, id, created_at, created_by_id) VALUES (%s, %s, %s, %s, %s)'] [parameters: (u'6f4bb053-1233-4789-a33c-67ff04321855', None, u'0189ce13-861f-4cb9-a24b-67facbfbe30e', datetime.datetime(2021, 8, 26, 21, 27, 40, 711213), u'2da5a9dc-a9cf-11ea-b597-4e978d5f1569')] (Background on this error at: http://sqlalche.me/e/e3q8))
Looks like is not finding the resource_id, but I`m setting this parameter.
What I`m doing wrong?
Thank you.