Closed manuelito02 closed 1 year ago
The Sequence Name field is internally "code", not "name". The Type field is not native, so likely "sg_type".
Check any field internal names by right-clicking on the field header in list view, and choosing Configure Field. Then see the "Field code:" at the top right.
Stephen
From: Carlo Giesa @.> Sent: Tuesday, August 8, 2023 8:11 AM To: shotgunsoftware/python-api @.> Cc: Subscribed @.***> Subject: [shotgunsoftware/python-api] 'name' and 'type' is missing when returning linked entities with custom fields (Issue #293)
Hi there!
There is a way to get additional fields of linked entities (not only 'id', 'name'/'code' and 'type') with the syntax
my_field.entity_type.entity_field
This is great to reduce the amount of queries to SG.
However, there seems to be a problem with the 'name' and 'type' field of that linked entity. Please check following code:
"Shot",
[["id", "is", 39190]],
["sg_sequence"],
)
This returns:
"Shot",
[["id", "is", 39190]],
[
"sg_sequence.Sequence.id",
"sg_sequence.Sequence.name",
"sg_sequence.Sequence.type",
"sg_sequence.Sequence.task_template",
],
)```
Here, I'm specifically asking for the 'id', 'name', 'type' and 'task_template' fields, but I get back following:
# [{'type': 'Shot', 'id': 39190, 'sg_sequence.Sequence.id': 17062, 'sg_sequence.Sequence.task_template': None}]```
I have my sequence 'id' and 'task_template', but not the 'name' and the 'type'.
Is this a bug or am I doing something wrong?
Greets,
Carlo
-
Reply to this email directly, view it on GitHub<https://github.com/shotgunsoftware/python-api/issues/293>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABPA337UXSNJRI2PC3B6IYLXUJJHLANCNFSM6AAAAAA3IUENAQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.******@***.***>>
Hi Stephen!
Thanks for your quick response!
Oh yes, of course, the code
vs name
. I'm always confused about this one. But type
doesn't seem to be a proper field (tested with sg_type
without success). This actually makes sense and gets probably automatically added when running the first request. The type should be the table. Would there be any way to get the 'default' fields (type, id, name) when querying a linked entity and request custom fields as well?
Greets, Carlo
Oh, actually, it works. Following code does exactly what I want:
app.sgtk.shotgun.find(
"Shot",
[["id", "is", 39190]],
[
"sg_sequence",
"sg_sequence.Sequence.task_template",
],
)
Hi there!
There is a way to get additional fields of linked entities (not only 'id', 'name'/'code' and 'type') with the syntax
my_field.entity_type.entity_field
This is great to reduce the amount of queries to SG.
However, there seems to be a problem with the 'name' and 'type' field of that linked entity. Please check following code:
This returns:
Results:
[{'type': 'Shot', 'id': 39190, 'sg_sequence.Sequence.id': 17062, 'sg_sequence.Sequence.task_template': None}]```
I have my sequence 'id' and 'task_template', but not the 'name' and the 'type'.
Is this a bug or am I doing something wrong?
Greets, Carlo