Skip to content

Commit d861410

Browse files
committed
docstring merge
1 parent 473110b commit d861410

4 files changed

Lines changed: 30 additions & 31 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The SDK provides a simple, pythonic interface for Dataverse operations:
100100
|---------|-------------|
101101
| **DataverseClient** | Main entry point for all operations with environment connection |
102102
| **Records** | Dataverse records represented as Python dictionaries with column schema names |
103-
| **Schema Names** | Use table schema names (`"account"`, `"new_MyTestTable"`) and column schema names (`"name"`, `"new_MyTestColumn"`). See: [Table definitions in Microsoft Dataverse](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/entity-metadata) |
103+
| **Schema names** | Use table schema names (`"account"`, `"new_MyTestTable"`) and column schema names (`"name"`, `"new_MyTestColumn"`). See: [Table definitions in Microsoft Dataverse](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/entity-metadata) |
104104
| **Bulk Operations** | Efficient bulk processing for multiple records with automatic optimization |
105105
| **Paging** | Automatic handling of large result sets with iterators |
106106
| **Structured Errors** | Detailed exception hierarchy with retry guidance and diagnostic information |

examples/advanced/file_upload.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def backoff(op, *, delays=(0,2,5,10), retry_status=(400,403,404,409,412,429,500,
166166

167167
# --------------------------- Table ensure ---------------------------
168168
TABLE_SCHEMA_NAME = "new_FileSample"
169-
# If user wants new customization prefix value / naming, adjust above.
170169

171170
def ensure_table():
172171
# Check by schema

src/PowerPlatform/Dataverse/client.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def create(self, table_schema_name: str, records: Union[Dict[str, Any], List[Dic
104104
"""
105105
Create one or more records by table name.
106106
107-
:param table_schema_name: Table schema name (e.g. ``"account"``, ``"contact"``, or ``"new_MyTestTable"``).
107+
:param table_schema_name: Schema name of the table (e.g. ``"account"``, ``"contact"``, or ``"new_MyTestTable"``).
108108
:type table_schema_name: ``str``
109109
:param records: A single record dictionary or a list of record dictionaries.
110110
Each dictionary should contain column schema names as keys.
@@ -157,7 +157,7 @@ def update(self, table_schema_name: str, ids: Union[str, List[str]], changes: Un
157157
2. Broadcast update: ``update("account", [id1, id2], {"status": 1})`` - applies same changes to all IDs
158158
3. Paired updates: ``update("account", [id1, id2], [changes1, changes2])`` - one-to-one mapping
159159
160-
:param table_schema_name: Table schema name (e.g. ``"account"`` or ``"new_MyTestTable"``).
160+
:param table_schema_name: Schema name of the table (e.g. ``"account"`` or ``"new_MyTestTable"``).
161161
:type table_schema_name: ``str``
162162
:param ids: Single GUID string or list of GUID strings to update.
163163
:type ids: ``str`` or ``list[str]``
@@ -210,7 +210,7 @@ def delete(
210210
"""
211211
Delete one or more records by GUID.
212212
213-
:param table_schema_name: Table schema name (e.g. ``"account"`` or ``"new_MyTestTable"``).
213+
:param table_schema_name: Schema name of the table (e.g. ``"account"`` or ``"new_MyTestTable"``).
214214
:type table_schema_name: ``str``
215215
:param ids: Single GUID string or list of GUID strings to delete.
216216
:type ids: ``str`` or ``list[str]``
@@ -266,19 +266,19 @@ def get(
266266
When ``record_id`` is provided, returns a single record dictionary.
267267
When ``record_id`` is None, returns a generator yielding batches of records.
268268
269-
:param table_schema_name: Table schema name (e.g. ``"account"`` or ``"new_MyTestTable"``).
269+
:param table_schema_name: Schema name of the table (e.g. ``"account"`` or ``"new_MyTestTable"``).
270270
:type table_schema_name: ``str``
271271
:param record_id: Optional GUID to fetch a specific record. If None, queries multiple records.
272272
:type record_id: ``str`` or ``None``
273273
:param select: Optional list of attribute logical names to retrieve. Column names are case-insensitive and automatically lowercased (e.g. ``["new_Title", "new_Amount"]`` becomes ``"new_title,new_amount"``).
274274
:type select: ``list[str]`` or ``None``
275-
:param filter: Optional OData filter string, e.g. ``"name eq 'Contoso'"`` or ``"new_quantity gt 5"``. **IMPORTANT: Column names in filter expressions must use exact lowercase logical names** (e.g. ``"new_quantity"``, not ``"new_Quantity"``). The filter string is passed directly to the Dataverse Web API without transformation.
275+
:param filter: Optional OData filter string, e.g. ``"name eq 'Contoso'"`` or ``"new_quantity gt 5"``. Column names in filter expressions must use exact lowercase logical names (e.g. ``"new_quantity"``, not ``"new_Quantity"``). The filter string is passed directly to the Dataverse Web API without transformation.
276276
:type filter: ``str`` or ``None``
277277
:param orderby: Optional list of attributes to sort by, e.g. ``["name asc", "createdon desc"]``. Column names are automatically lowercased.
278278
:type orderby: ``list[str]`` or ``None``
279279
:param top: Optional maximum number of records to return.
280280
:type top: ``int`` or ``None``
281-
:param expand: Optional list of navigation properties to expand, e.g. ``["primarycontactid"]``. **IMPORTANT: Navigation property names are case-sensitive and must match the server-defined names exactly.**. These are NOT automatically transformed. Consult entity metadata for correct casing.
281+
:param expand: Optional list of navigation properties to expand, e.g. ``["primarycontactid"]``. Navigation property names are case-sensitive and must match the server-defined names exactly. These are NOT automatically transformed. Consult entity metadata for correct casing.
282282
:type expand: ``list[str]`` or ``None``
283283
:param page_size: Optional number of records per page for pagination.
284284
:type page_size: ``int`` or ``None``
@@ -386,7 +386,7 @@ def get_table_info(self, table_schema_name: str) -> Optional[Dict[str, Any]]:
386386
"""
387387
Get basic metadata for a table if it exists.
388388
389-
:param table_schema_name: Table schema name (e.g. ``"new_MyTestTable"`` or ``"account"``).
389+
:param table_schema_name: Schema name of the table (e.g. ``"new_MyTestTable"`` or ``"account"``).
390390
:type table_schema_name: ``str``
391391
392392
:return: Dictionary containing table metadata with keys ``table_schema_name``,
@@ -414,7 +414,7 @@ def create_table(
414414
"""
415415
Create a simple custom table with specified columns.
416416
417-
:param table_schema_name: Table schema name with customization prefix value (e.g. ``"new_MyTestTable"``).
417+
:param table_schema_name: Schema name of the table with customization prefix value (e.g. ``"new_MyTestTable"``).
418418
:type table_schema_name: ``str``
419419
:param columns: Dictionary mapping column names (with customization prefix value) to their types. All custom column names must include the customization prefix value (e.g. ``"new_Title"``).
420420
Supported types:
@@ -431,7 +431,7 @@ class ItemStatus(IntEnum):
431431
1036: {"Active": "Actif", "Inactive": "Inactif"}
432432
}
433433
434-
:type schema: dict[str, Any]
434+
:type columns: dict[str, Any]
435435
:param solution_unique_name: Optional solution unique name that should own the new table. When omitted the table is created in the default solution.
436436
:type solution_unique_name: ``str`` or ``None``
437437
:param primary_column_schema_name: Optional primary name column schema name with customization prefix value (e.g. ``"new_MyTestTable"``). If not provided, defaults to ``"{customization prefix value}_Name"``.
@@ -483,7 +483,7 @@ def delete_table(self, table_schema_name: str) -> None:
483483
"""
484484
Delete a custom table by name.
485485
486-
:param table_schema_name: Table schema name (e.g. ``"new_MyTestTable"`` or ``"account"``).
486+
:param table_schema_name: Schema name of the table (e.g. ``"new_MyTestTable"`` or ``"account"``).
487487
:type table_schema_name: ``str``
488488
489489
:raises ~PowerPlatform.Dataverse.core.errors.MetadataError: If the table does not exist or deletion fails.
@@ -523,7 +523,7 @@ def create_columns(
523523
"""
524524
Create one or more columns on an existing table using a schema-style mapping.
525525
526-
:param table_schema_name: Table schema name (e.g. ``"new_MyTestTable"``).
526+
:param table_schema_name: Schema name of the table (e.g. ``"new_MyTestTable"``).
527527
:type table_schema_name: ``str``
528528
:param columns: Mapping of column schema names (with customization prefix value) to supported types. All custom column names must include the customization prefix value** (e.g. ``"new_Notes"``). Primitive types include
529529
``string``, ``int``, ``decimal``, ``float``, ``datetime``, and ``bool``. Enum subclasses (IntEnum preferred)
@@ -556,7 +556,7 @@ def delete_columns(
556556
"""
557557
Delete one or more columns from a table.
558558
559-
:param table_schema_name: Table schema name (e.g. ``"new_MyTestTable"``).
559+
:param table_schema_name: Schema name of the table (e.g. ``"new_MyTestTable"``).
560560
:type table_schema_name: ``str``
561561
:param columns: Column name or list of column names to remove. Must include customization prefix value (e.g. ``"new_TestColumn"``).
562562
:type columns: ``str`` | ``list[str]``
@@ -590,7 +590,7 @@ def upload_file(
590590
"""
591591
Upload a file to a Dataverse file column.
592592
593-
:param table_schema_name: Table schema name, e.g. ``"account"`` or ``"new_MyTestTable"``.
593+
:param table_schema_name: Schema name of the table, e.g. ``"account"`` or ``"new_MyTestTable"``.
594594
:type table_schema_name: ``str``
595595
:param record_id: GUID of the target record.
596596
:type record_id: ``str``

src/PowerPlatform/Dataverse/data/odata.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def _create(self, entity_set: str, table_schema_name: str, record: Dict[str, Any
178178
179179
:param entity_set: Resolved entity set (plural) name.
180180
:type entity_set: ``str``
181-
:param table_schema_name: Table schema name.
181+
:param table_schema_name: Schema name of the table.
182182
:type table_schema_name: ``str``
183183
:param record: Attribute payload mapped by logical column names.
184184
:type record: ``dict[str, Any]``
@@ -215,7 +215,7 @@ def _create_multiple(self, entity_set: str, table_schema_name: str, records: Lis
215215
216216
:param entity_set: Resolved entity set (plural) name.
217217
:type entity_set: ``str``
218-
:param table_schema_name: Table schema name.
218+
:param table_schema_name: Schema name of the table.
219219
:type table_schema_name: ``str``
220220
:param records: Payload dictionaries mapped by column schema names.
221221
:type records: ``list[dict[str, Any]]``
@@ -291,7 +291,7 @@ def _primary_id_attr(self, table_schema_name: str) -> str:
291291
def _update_by_ids(self, table_schema_name: str, ids: List[str], changes: Union[Dict[str, Any], List[Dict[str, Any]]]) -> None:
292292
"""Update many records by GUID list using the collection-bound ``UpdateMultiple`` action.
293293
294-
:param table_schema_name: Table schema name.
294+
:param table_schema_name: Schema name of the table.
295295
:type table_schema_name: ``str``
296296
:param ids: GUIDs of target records.
297297
:type ids: ``list[str]``
@@ -413,7 +413,7 @@ def esc(match):
413413
def _update(self, table_schema_name: str, key: str, data: Dict[str, Any]) -> None:
414414
"""Update an existing record by GUID.
415415
416-
:param table_schema_name: Table schema name.
416+
:param table_schema_name: Schema name of the table.
417417
:type table_schema_name: ``str``
418418
:param key: Record GUID (with or without parentheses).
419419
:type key: ``str``
@@ -434,7 +434,7 @@ def _update_multiple(self, entity_set: str, table_schema_name: str, records: Lis
434434
435435
:param entity_set: Resolved entity set (plural) name.
436436
:type entity_set: ``str``
437-
:param table_schema_name: Table schema name, e.g. "new_MyTestTable".
437+
:param table_schema_name: Schema name of the table, e.g. "new_MyTestTable".
438438
:type table_schema_name: ``str``
439439
:param records: List of patch dictionaries. Each must include the true primary key attribute (e.g. ``accountid``) and one or more fields to update.
440440
:type records: ``list[dict[str, Any]]``
@@ -475,7 +475,7 @@ def _update_multiple(self, entity_set: str, table_schema_name: str, records: Lis
475475
def _delete(self, table_schema_name: str, key: str) -> None:
476476
"""Delete a record by GUID.
477477
478-
:param table_schema_name: Table schema name.
478+
:param table_schema_name: Schema name of the table.
479479
:type table_schema_name: ``str``
480480
:param key: Record GUID (with or without parentheses)
481481
:type key: ``str``
@@ -490,7 +490,7 @@ def _delete(self, table_schema_name: str, key: str) -> None:
490490
def _get(self, table_schema_name: str, key: str, select: Optional[str] = None) -> Dict[str, Any]:
491491
"""Retrieve a single record.
492492
493-
:param table_schema_name: Table schema name.
493+
:param table_schema_name: Schema name of the table.
494494
:type table_schema_name: ``str``
495495
:param key: Record GUID (with or without parentheses).
496496
:type key: ``str``
@@ -521,17 +521,17 @@ def _get_multiple(
521521
) -> Iterable[List[Dict[str, Any]]]:
522522
"""Iterate records from an entity set, yielding one page (list of dicts) at a time.
523523
524-
:param table_schema_name: Table schema name.
524+
:param table_schema_name: Schema name of the table.
525525
:type table_schema_name: ``str``
526526
:param select: Columns to include (``$select``) or ``None``. Column names are automatically lowercased.
527527
:type select: ``list[str]`` | ``None``
528-
:param filter: OData ``$filter`` expression or ``None``. IMPORTANT: This is passed as-is without transformation. Users must provide lowercase logical column names (e.g., "statecode eq 0").
528+
:param filter: OData ``$filter`` expression or ``None``. This is passed as-is without transformation. Users must provide lowercase logical column names (e.g., "statecode eq 0").
529529
:type filter: ``str`` | ``None``
530530
:param orderby: Order expressions (``$orderby``) or ``None``. Column names are automatically lowercased.
531531
:type orderby: ``list[str]`` | ``None``
532532
:param top: Max total records (applied on first request as ``$top``) or ``None``.
533533
:type top: ``int`` | ``None``
534-
:param expand: Navigation properties to expand (``$expand``) or ``None``. IMPORTANT: These are case-sensitive and passed as-is. Users must provide exact navigation property names from entity metadata.
534+
:param expand: Navigation properties to expand (``$expand``) or ``None``. These are case-sensitive and passed as-is. Users must provide exact navigation property names from entity metadata.
535535
:type expand: ``list[str]`` | ``None``
536536
:param page_size: Per-page size hint via ``Prefer: odata.maxpagesize``.
537537
:type page_size: ``int`` | ``None``
@@ -1147,7 +1147,7 @@ def _attribute_payload(self, column_schema_name: str, dtype: Any, *, is_primary_
11471147
def _get_table_info(self, table_schema_name: str) -> Optional[Dict[str, Any]]:
11481148
"""Return basic metadata for a custom table if it exists.
11491149
1150-
:param table_schema_name: Table schema name.
1150+
:param table_schema_name: Schema name of the table.
11511151
:type table_schema_name: ``str``
11521152
11531153
:return: Metadata summary or ``None`` if not found.
@@ -1180,9 +1180,9 @@ def _list_tables(self) -> List[Dict[str, Any]]:
11801180
return r.json().get("value", [])
11811181

11821182
def _delete_table(self, table_schema_name: str) -> None:
1183-
"""Delete a table by SchemaName. Case-insensitive.
1183+
"""Delete a table by schema name.
11841184
1185-
:param table_schema_name: Table schema name.
1185+
:param table_schema_name: Schema name of the table.
11861186
:type table_schema_name: ``str``
11871187
11881188
:return: ``None``
@@ -1210,7 +1210,7 @@ def _create_table(
12101210
) -> Dict[str, Any]:
12111211
"""Create a custom table with specified columns.
12121212
1213-
:param table_schema_name: Table schema name.
1213+
:param table_schema_name: Schema name of the table.
12141214
:type table_schema_name: ``str``
12151215
:param schema: Mapping of column name -> type spec (``str`` or ``Enum`` subclass).
12161216
:type schema: ``dict[str, Any]``
@@ -1281,7 +1281,7 @@ def _create_columns(
12811281
) -> List[str]:
12821282
"""Create new columns on an existing table.
12831283
1284-
:param table_schema_name: Table schema name.
1284+
:param table_schema_name: Schema name of the table.
12851285
:type table_schema_name: ``str``
12861286
:param columns: Mapping of column schema name -> type spec (``str`` or ``Enum`` subclass).
12871287
:type columns: ``dict[str, Any]``
@@ -1333,7 +1333,7 @@ def _delete_columns(
13331333
) -> List[str]:
13341334
"""Delete one or more columns from a table.
13351335
1336-
:param table_schema_name: Table schema name.
1336+
:param table_schema_name: Schema name of the table.
13371337
:type table_schema_name: ``str``
13381338
:param columns: Single column name or list of column names
13391339
:type columns: ``str`` | ``list[str]``

0 commit comments

Comments
 (0)