Skip to content

Conversation

@zhaodongwang-msft
Copy link
Collaborator

This pull request adds comprehensive support for creating and deleting columns on existing Dataverse tables, both in the core SDK and the quickstart example. The changes include new high-level methods on the client, robust schema normalization for column names, and detailed error handling for column operations. Documentation and usage examples have also been updated to reflect these new capabilities.

New column management features:

  • Added create_columns and delete_columns methods to DataverseClient, allowing users to add or remove columns from existing tables using a simple schema mapping. These methods return the schema names of affected columns and handle both friendly and schema names. (src/dataverse_sdk/client.py [1] src/dataverse_sdk/odata.py [2]
  • Implemented internal helpers for normalizing entity and attribute schema names, ensuring consistent naming and publisher prefixing for columns. (src/dataverse_sdk/odata.py [1] [2] [3]

Error handling improvements:

  • Introduced a new error code for missing columns (METADATA_COLUMN_NOT_FOUND) and robust error handling in column operations. (src/dataverse_sdk/error_codes.py [1] src/dataverse_sdk/odata.py [2]

Documentation and usage examples:

  • Updated the README.md to document the new column creation and deletion methods, including API docs and usage examples. (README.md [1] [2] [3]
  • Enhanced the examples/quickstart.py script to demonstrate column creation and deletion, including metadata verification and error reporting. (examples/quickstart.py [1] [2] [3]

Internal consistency and refactoring:

  • Refactored internal table and column schema normalization to use new helper methods, improving code maintainability and reducing duplication. (src/dataverse_sdk/odata.py [1] [2]

These changes significantly improve the SDK's support for dynamic table schema management in Dataverse.

Copilot AI review requested due to automatic review settings November 4, 2025 18:45
Copy link
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

This PR adds column-level metadata management capabilities to the Dataverse SDK, enabling developers to create and delete individual columns on existing tables without recreating entire tables. It refactors entity/attribute schema normalization into dedicated helper methods and introduces corresponding client APIs with detailed documentation and validation.

  • Refactored inline schema normalization into reusable _normalize_entity_schema and _normalize_attribute_schema methods
  • Added create_columns and delete_columns methods to support adding/removing columns on existing tables
  • Integrated column metadata operations in the quickstart example with validation and retry logic

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/dataverse_sdk/odata.py Adds helper methods for schema normalization, attribute metadata retrieval, and column create/delete operations with picklist cache management
src/dataverse_sdk/error_codes.py Introduces METADATA_COLUMN_NOT_FOUND error code for column deletion validation
src/dataverse_sdk/client.py Exposes public create_columns and delete_columns methods with comprehensive docstrings
examples/quickstart.py Demonstrates column create/delete workflow with metadata validation and backoff retry logic
README.md Updates feature descriptions and API reference table to reflect column management capabilities
Comments suppressed due to low confidence (1)

src/dataverse_sdk/odata.py:3

  • Import of 'Tuple' is not used.
from typing import Any, Dict, Optional, List, Union, Iterable, Tuple

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zhaodongwang-msft zhaodongwang-msft merged commit 31ec26f into main Nov 4, 2025
5 checks passed
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.

3 participants