Add Projects.get_by_path() for hierarchy-aware project lookup#1804
Open
jacalata wants to merge 3 commits into
Open
Add Projects.get_by_path() for hierarchy-aware project lookup#1804jacalata wants to merge 3 commits into
jacalata wants to merge 3 commits into
Conversation
Fixes #1317 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add test cases for trailing slash, root-level disambiguation (API returns same-named projects at different hierarchy levels), duplicate siblings (first result is used), deep three-level paths, and names containing spaces. Add three new XML fixture files to support these scenarios. Improve the get_by_path docstring to document the client-side root-level parentProjectId filter, the duplicate-name tie-break, and the empty-component-stripping behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Projects.get_by_path(path), resolving a slash-separated path like"Marketing/Q1 Reports"to aProjectItem(orNoneif not found)namefilter, issuing one request per path component; at the root level results are post-filtered in Python forparent_id is Nonebecause the REST API does not support a null-equality filter forparentProjectIdCloses #1227
Schema compliance
parentProjectIdis a validresourceIdTypeattribute onprojectTypein the Tableau REST API XSD (confirmed in ts-api_3_29.xsd).RequestOptions.Field.ParentProjectId = "parentProjectId"matches the schema exactly. The Projects endpoint's existingfilter()docstring listsparent_project_idas a supported server-side filter.Test plan
python -m pytest test/test_project.py -v-- 31 tests, all passserver.projects.get_by_path("Default")returns the Default project on a real siteserver.projects.get_by_path("Parent/Child")resolves a known nested projectserver.projects.get_by_path("does-not-exist")returnsNoneserver.projects.get_by_path("")raisesValueError🤖 Generated with Claude Code