[2022.3] parent_id lost when creating project
Describe the bug
parent_id is None in the ProjectItem object returned by projects.create() even if it was specified when creating the new instance.
Versions
- Tableau Server 2022.3.1
- Python 3.10.9
- TSC library 0.23.4
To Reproduce
>>> new_project = TSC.ProjectItem('New Project', parent_id='c7fc0e49-8d67-4211-9623-dd9237bf3cda')
>>> new_project.id
>>> new_project.parent_id
'c7fc0e49-8d67-4211-9623-dd9237bf3cda'
>>> new_project = server.projects.create(new_project)
INFO:tableau.endpoint.projects:Created new project (ID: e0e88607-abe5-4548-963e-b5f5054c5cbe)
>>> new_project.id
'e0e88607-abe5-4548-963e-b5f5054c5cbe'
>>> new_project.parent_id
>>>
Results What are the results or error messages received?
new_project.parent_id should be preserved, but it is reset to None
It looks like this is a bug in Tableau Server REST API not returning the parent id, the response received from server is:
<?xml version="1.0"?>
<ns0:tsResponse xmlns:ns0="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api https://help.tableau.com/samples/en-us/rest_api/ts-api_3_17.xsd">
<ns0:project id="1dce43d0-ced8-4cd6-a6b4-574600ecc474" name="SubProject" description="" createdAt="2023-01-13T14:30:16Z" updatedAt="2023-01-13T14:30:16Z" contentPermissions="ManagedByOwner">
<ns0:owner id="00d91b33-508a-40d6-b0a8-ddd485d91c6b"/>
</ns0:project>
</ns0:tsResponse>
The REST API documentation suggests that parentProjectId should be included.
Are you seeing this consistently? I can't reproduce this against Tableau Online right now. Here's what I get with the same code:
>> project_item.id
'18149fd2-2443-4ea0-8f77-572aa75ed4a2'
>> child_project = TSC.ProjectItem(name="Child Project 2", parent_id=project_item.id)
>> child_project = server.projects.create(child_project)
>> child_project.id, child_project.name, child_project.parent_id
('817fd637-b2b3-4242-acf5-c09eb76d20bb', 'Child Project 2', '18149fd2-2443-4ea0-8f77-572aa75ed4a2')
And the server response looks ok too:
<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<tsResponse>
<project id="a0f5e6bb-745d-470a-8254-feb3e537b874" name="Child Project 2" description=""
parentProjectId="a6cf7494-9fc9-467a-93d7-67154e1bbd98" createdAt="2023-02-15T07:14:47Z" updatedAt="2023-02-15T07:14:47Z" contentPermissions="ManagedByOwner"><owner id="e41a95fa-182d-47e5-bf24-9652f3d6fab0"/></project>
</tsResponse>'
Are you seeing this consistently?
Yes.
>>> new_project = TSC.ProjectItem('New Project', parent_id='9bf4cb68-9498-471f-97ac-b86f5f57465b')
>>> new_project.id, new_project.name, new_project.parent_id
(None, 'New Project', '9bf4cb68-9498-471f-97ac-b86f5f57465b')
>>> new_project = server.projects.create(new_project)
>>> new_project.id, new_project.name, new_project.parent_id
('3e8a0626-74c8-4f9c-9a71-955910430a57', 'New Project', None)
Server response:
<?xml version="1.0"?>
<ns0:tsResponse xmlns:ns0="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api https://help.tableau.com/samples/en-us/rest_api/ts-api_3_17.xsd">
<ns0:project id="3e8a0626-74c8-4f9c-9a71-955910430a57" name="New Project" description="" controllingPermissionsProjectId="7575b541-9dee-41a7-81a5-fdc52b695207" createdAt="2023-02-15T08:05:55Z" updatedAt="2023-02-15T08:05:55Z" contentPermissions="LockedToProject">
<ns0:owner id="00d91b33-508a-40d6-b0a8-ddd485d91c6b"/>
</ns0:project>
</ns0:tsResponse>
I can't reproduce this against Tableau Online right now.
I'm seeing it on Tableau Server 2022.3.3 (and was earlier seeing it on 2022.3.1)
ok - I can reproduce it against 22.3, so it looks like a bug that has since been fixed. I've forwarded this to the feature team to see if they can fix it in a maintenance release.
This has been fixed in a maintenance release (March, I think).