Skip to content

Allow passing display_name parameter when creating tables#164

Open
abelmilash-msft wants to merge 7 commits intomainfrom
users/abelmilash/issue-163-display-name
Open

Allow passing display_name parameter when creating tables#164
abelmilash-msft wants to merge 7 commits intomainfrom
users/abelmilash/issue-163-display-name

Conversation

@abelmilash-msft
Copy link
Copy Markdown
Contributor

Summary

  • Add optional display_name parameter to client.tables.create(), batch.tables.create(), and the internal _create_table / _build_create_entity methods
  • When omitted, display name defaults to the table schema name (existing behavior preserved)

Tests

  • TestBuildCreateEntity — direct payload tests for _build_create_entity with and without display_name
  • test_dispatch_table_create_forwards_display_name — verifies batch path forwards the value
  • test_display_name_used_in_payload_when_provided / test_display_name_defaults_to_schema_name — verifies _create_table behavior

Closes #163

Abel Milash and others added 3 commits April 20, 2026 10:12
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…patch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 20, 2026 19:18
@abelmilash-msft abelmilash-msft requested a review from a team as a code owner April 20, 2026 19:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new optional display_name parameter to table-creation APIs so callers can set a human-friendly Dataverse table display name instead of being forced to use the schema name (default behavior remains unchanged when omitted).

Changes:

  • Extend client.tables.create() and batch.tables.create() to accept optional display_name and forward it through internal layers.
  • Update _ODataClient._create_table() and _ODataClient._build_create_entity() to use the provided display name (falling back to schema name).
  • Add/adjust unit tests to cover payload construction and forwarding for both direct and batch creation paths.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/PowerPlatform/Dataverse/operations/tables.py Adds display_name to TableOperations.create() and forwards it to _create_table.
src/PowerPlatform/Dataverse/operations/batch.py Adds display_name to BatchTableOperations.create() and stores it on _TableCreate.
src/PowerPlatform/Dataverse/data/_odata.py Adds display_name plumbing and uses it in create payloads for both immediate and batch-built entity creation.
src/PowerPlatform/Dataverse/data/_batch.py Extends _TableCreate intent and forwards display_name into _build_create_entity.
tests/unit/test_tables_operations.py Verifies display_name is forwarded from tables.create() into _create_table.
tests/unit/test_client_deprecations.py Updates expectations for the extra forwarded arg into _create_table (default None).
tests/unit/data/test_odata_internal.py Adds coverage for _create_table/_build_create_entity payload label behavior with/without display_name.
tests/unit/data/test_batch_serialization.py Verifies batch resolver forwards display_name into _build_create_entity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PowerPlatform/Dataverse/data/_odata.py Outdated
Comment thread src/PowerPlatform/Dataverse/data/_odata.py
Abel Milash and others added 4 commits April 20, 2026 14:07
…ss fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pe+empty check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d _build_create_entity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…coverage

Adds 12 tests covering HTTP structure (method, URL, solution query param),
payload fields (SchemaName, OwnershipType, Description), primary column
derivation (prefix, explicit, no-underscore default), column inclusion,
and unsupported column type error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@abelmilash-msft abelmilash-msft force-pushed the users/abelmilash/issue-163-display-name branch from b9f13b2 to bf45a33 Compare April 20, 2026 22:28
schema: Dict[str, Any],
solution_unique_name: Optional[str] = None,
primary_column_schema_name: Optional[str] = None,
display_name: Optional[str] = None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in one of the existing integration tests, pass the display name to make sure coverage.

"DisplayCollectionName": self._label(table + "s"),
"Description": self._label(f"Custom entity for {table}"),
"DisplayName": self._label(label),
"DisplayCollectionName": self._label(label + "s"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be wrong if the DisplayName is 'Person'. Instead of computing, there should be a library we are using to convert to plural. Try to use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tables.create() hardcodes display_name to table_schema_name with no way to override

3 participants