You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fix OData filter injection vulnerability in _get_relationship by using
_escape_odata_quotes() to sanitize schema_name input
- Fix late binding closure bug in relationships.py cleanup loop
- Remove unused imports (HttpError, MetadataError, pytest)
- Initialize relationship IDs to None for cleanup safety
- Add relationship management section to README with examples
- Update docstring examples to use intuitive Department/Employee/Project
scenario with helpful comments
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@@ -36,6 +37,7 @@ A Python client library for Microsoft Dataverse that provides a unified interfac
36
37
-**⚡ True Bulk Operations**: Automatically uses Dataverse's native `CreateMultiple`, `UpdateMultiple`, and `BulkDelete` Web API operations for maximum performance and transactional integrity
37
38
-**📊 SQL Queries**: Execute read-only SQL queries via the Dataverse Web API `?sql=` parameter
38
39
-**🏗️ Table Management**: Create, inspect, and delete custom tables and columns programmatically
40
+
-**🔗 Relationship Management**: Create one-to-many and many-to-many relationships between tables with full metadata control
39
41
-**📎 File Operations**: Upload files to Dataverse file columns with automatic chunking for large files
40
42
-**🔐 Azure Identity**: Built-in authentication using Azure Identity credential providers with comprehensive support
41
43
-**🛡️ Error Handling**: Structured exception hierarchy with detailed error context and retry guidance
> **Important**: All custom column names must include the customization prefix value (e.g., `"new_"`).
240
+
> **Important**: All custom column names must include the customization prefix value (e.g., `"new_"`).
239
241
> This ensures explicit, predictable naming and aligns with Dataverse metadata requirements.
240
242
243
+
### Relationship management
244
+
245
+
Create relationships between tables using the relationship API. For a complete working example, see [examples/advanced/relationships.py](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/advanced/relationships.py).
246
+
247
+
```python
248
+
from PowerPlatform.Dataverse.models.metadata import (
249
+
LookupAttributeMetadata,
250
+
OneToManyRelationshipMetadata,
251
+
ManyToManyRelationshipMetadata,
252
+
Label,
253
+
LocalizedLabel,
254
+
)
255
+
256
+
# Create a one-to-many relationship: Department (1) -> Employee (N)
257
+
# This adds a "Department" lookup field to the Employee table
from PowerPlatform.Dataverse.extensions.relationships import create_lookup_field
297
+
298
+
# Quick way to create a lookup field with sensible defaults
299
+
result = create_lookup_field(
300
+
client,
301
+
referencing_table="contact", # Child table gets the lookup field
302
+
lookup_field_name="new_AccountId",
303
+
referenced_table="account", # Parent table being referenced
304
+
display_name="Account",
305
+
)
306
+
```
307
+
241
308
### File operations
242
309
243
310
```python
@@ -261,7 +328,8 @@ Explore our comprehensive examples in the [`examples/`](https://github.com/micro
261
328
-**[Functional Testing](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/basic/functional_testing.py)** - Test core functionality in your environment
262
329
263
330
**🚀 Advanced Usage:**
264
-
-**[Complete Walkthrough](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/advanced/walkthrough.py)** - Full feature demonstration with production patterns
331
+
-**[Complete Walkthrough](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/advanced/walkthrough.py)** - Full feature demonstration with production patterns
332
+
-**[Relationship Management](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/advanced/relationships.py)** - Create and manage table relationships
265
333
-**[File Upload](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/advanced/file_upload.py)** - Upload files to Dataverse file columns
266
334
267
335
📖 See the [examples README](https://github.com/microsoft/PowerPlatform-DataverseClient-Python/blob/main/examples/README.md) for detailed guidance and learning progression.
@@ -323,8 +391,7 @@ For optimal performance in production environments:
323
391
### Limitations
324
392
325
393
- SQL queries are **read-only** and support a limited subset of SQL syntax
326
-
- Create Table supports a limited number of column types. Lookup columns are not yet supported.
327
-
- Creating relationships between tables is not yet supported.
394
+
- Create Table supports a limited number of column types (string, int, decimal, bool, datetime, picklist)
328
395
- File uploads are limited by Dataverse file size restrictions (default 128MB per file)
0 commit comments