Skip to content

Conversation

@jeffandms
Copy link
Contributor

This expands the schema available on create table, as well as adds a separate discrete method for adding relationships.

Also removes previous incorrect escaping of schemanames, since schema names cannot contain quote marks.

@JimDaly
Copy link
Member

JimDaly commented Sep 17, 2025

Generally, I think helper functions like this create_lookup_field method ought to be available as extensions and not baked into the official SDK.

Dataverse message operations are defined as names, and there is no CreateLookupAttribute message. You create a lookup while creating the relationship with the CreateOneToManyRequest Class

This specific named action isn't present in OData, but it could be. Instead, we implemented POST to /RelationshipDefinitions

I think we ought to do the work to add the underlying Metadata Entity Types so that Jeff (or anyone) could use them to compose these types of operations on top of a message named create_one_to_many_relationship rather than starting with create_lookup_field.

@JimDaly JimDaly self-requested a review September 17, 2025 21:02
tpellissier-msft pushed a commit that referenced this pull request Jan 12, 2026
Implements architectural pattern suggested in PR #12 review feedback:
- Core SDK provides low-level operations that mirror .NET SDK (CreateOneToManyRequest)
- Operations are named after Dataverse messages, not high-level helper functions
- Extension helpers provide convenience wrappers for common scenarios
- Uses proper Metadata Entity Types exposed via models

Changes:
- Add models/metadata.py with Metadata Entity Type classes
  - LookupAttributeMetadata, OneToManyRelationshipMetadata, ManyToManyRelationshipMetadata
  - Label, LocalizedLabel, CascadeConfiguration, AssociatedMenuConfiguration
- Add relationship operations to data/_odata.py
  - _create_one_to_many_relationship (POST /RelationshipDefinitions)
  - _create_many_to_many_relationship
  - _delete_relationship, _get_relationship
- Expose public API in client.py
  - create_one_to_many_relationship, create_many_to_many_relationship
  - delete_relationship, get_relationship
- Add extensions/relationships.py with helper functions
  - create_lookup_field (convenience wrapper)
- Add examples/advanced/relationships.py demonstrating both approaches

This approach aligns with Dataverse's actual API structure and allows users
to compose operations using the underlying metadata types, while still
providing convenience helpers as opt-in extensions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
tpellissier-msft pushed a commit that referenced this pull request Jan 12, 2026
Implements architectural pattern suggested in PR #12 review feedback:
- Core SDK provides low-level operations that mirror .NET SDK (CreateOneToManyRequest)
- Operations are named after Dataverse messages, not high-level helper functions
- Extension helpers provide convenience wrappers for common scenarios
- Uses proper Metadata Entity Types exposed via models

Changes:
- Add models/metadata.py with Metadata Entity Type classes
  - LookupAttributeMetadata, OneToManyRelationshipMetadata, ManyToManyRelationshipMetadata
  - Label, LocalizedLabel, CascadeConfiguration, AssociatedMenuConfiguration
- Add relationship operations to data/_odata.py
  - _create_one_to_many_relationship (POST /RelationshipDefinitions)
  - _create_many_to_many_relationship
  - _delete_relationship, _get_relationship
- Expose public API in client.py
  - create_one_to_many_relationship, create_many_to_many_relationship
  - delete_relationship, get_relationship
- Add extensions/relationships.py with helper functions
  - create_lookup_field (convenience wrapper)
- Add examples/advanced/relationships.py demonstrating both approaches

This approach aligns with Dataverse's actual API structure and allows users
to compose operations using the underlying metadata types, while still
providing convenience helpers as opt-in extensions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
tpellissier-msft pushed a commit that referenced this pull request Jan 12, 2026
Implements architectural pattern suggested in PR #12 review feedback:
- Core SDK provides low-level operations that mirror .NET SDK (CreateOneToManyRequest)
- Operations are named after Dataverse messages, not high-level helper functions
- Extension helpers provide convenience wrappers for common scenarios
- Uses proper Metadata Entity Types exposed via models

Changes:
- Add models/metadata.py with Metadata Entity Type classes
  - LookupAttributeMetadata, OneToManyRelationshipMetadata, ManyToManyRelationshipMetadata
  - Label, LocalizedLabel, CascadeConfiguration, AssociatedMenuConfiguration
- Add relationship operations to data/_odata.py
  - _create_one_to_many_relationship (POST /RelationshipDefinitions)
  - _create_many_to_many_relationship
  - _delete_relationship, _get_relationship
- Expose public API in client.py
  - create_one_to_many_relationship, create_many_to_many_relationship
  - delete_relationship, get_relationship
- Add extensions/relationships.py with helper functions
  - create_lookup_field (convenience wrapper)
- Add examples/advanced/relationships.py demonstrating both approaches

This approach aligns with Dataverse's actual API structure and allows users
to compose operations using the underlying metadata types, while still
providing convenience helpers as opt-in extensions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
tpellissier-msft pushed a commit that referenced this pull request Jan 13, 2026
Implements architectural pattern suggested in PR #12 review feedback:
- Core SDK provides low-level operations that mirror .NET SDK (CreateOneToManyRequest)
- Operations are named after Dataverse messages, not high-level helper functions
- Extension helpers provide convenience wrappers for common scenarios
- Uses proper Metadata Entity Types exposed via models

Changes:
- Add models/metadata.py with Metadata Entity Type classes
  - LookupAttributeMetadata, OneToManyRelationshipMetadata, ManyToManyRelationshipMetadata
  - Label, LocalizedLabel, CascadeConfiguration, AssociatedMenuConfiguration
- Add relationship operations to data/_odata.py
  - _create_one_to_many_relationship (POST /RelationshipDefinitions)
  - _create_many_to_many_relationship
  - _delete_relationship, _get_relationship
- Expose public API in client.py
  - create_one_to_many_relationship, create_many_to_many_relationship
  - delete_relationship, get_relationship
- Add extensions/relationships.py with helper functions
  - create_lookup_field (convenience wrapper)
- Add examples/advanced/relationships.py demonstrating both approaches

This approach aligns with Dataverse's actual API structure and allows users
to compose operations using the underlying metadata types, while still
providing convenience helpers as opt-in extensions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
tpellissier-msft pushed a commit that referenced this pull request Jan 15, 2026
Implements architectural pattern suggested in PR #12 review feedback:
- Core SDK provides low-level operations that mirror .NET SDK (CreateOneToManyRequest)
- Operations are named after Dataverse messages, not high-level helper functions
- Extension helpers provide convenience wrappers for common scenarios
- Uses proper Metadata Entity Types exposed via models

Changes:
- Add models/metadata.py with Metadata Entity Type classes
  - LookupAttributeMetadata, OneToManyRelationshipMetadata, ManyToManyRelationshipMetadata
  - Label, LocalizedLabel, CascadeConfiguration, AssociatedMenuConfiguration
- Add relationship operations to data/_odata.py
  - _create_one_to_many_relationship (POST /RelationshipDefinitions)
  - _create_many_to_many_relationship
  - _delete_relationship, _get_relationship
- Expose public API in client.py
  - create_one_to_many_relationship, create_many_to_many_relationship
  - delete_relationship, get_relationship
- Add extensions/relationships.py with helper functions
  - create_lookup_field (convenience wrapper)
- Add examples/advanced/relationships.py demonstrating both approaches

This approach aligns with Dataverse's actual API structure and allows users
to compose operations using the underlying metadata types, while still
providing convenience helpers as opt-in extensions.
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.

4 participants