Skip to content

Commit ca991c4

Browse files
committed
Merge branch 'user/tpellissier/logical_name_prefix' of https://github.com/microsoft/PowerPlatform-DataverseClient-Python into user/tpellissier/logical_name_prefix
2 parents ef91adc + 226d29f commit ca991c4

5 files changed

Lines changed: 6 additions & 9 deletions

File tree

examples/basic/quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def run_paging_demo(label: str, *, top: Optional[int], page_size: Optional[int])
551551

552552
# 6) Column metadata helpers: column create/delete
553553
print("Column metadata helpers (create/delete column):")
554-
scratch_column = f"scratch_{int(time.time())}"
554+
scratch_column = f"new_scratch_{int(time.time())}"
555555
column_payload = {scratch_column: "string"}
556556
try:
557557
log_call(f"client.create_column('{logical}', {repr(column_payload)})")

src/dataverse_sdk/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def create_table(
403403
"""
404404
Create a simple custom table with specified columns.
405405
406-
:param logical_name: Table logical name with publisher prefix (e.g. ``"new_orders"``).
406+
:param logical_name: Table logical name with publisher prefix (e.g. ``"new_sampleitem"``).
407407
Both table and column names must include the publisher prefix (default is ``"new_"``).
408408
:type logical_name: str
409409
:param schema: Dictionary mapping column logical names (with prefix) to their types.

src/dataverse_sdk/data/odata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def _get_entity_metadata(self, logical_name: str) -> TableMetadata:
711711
return metadata
712712

713713
def _logical_to_schema_name(self, logical_name: str) -> str:
714-
"""Convert logical name (new_sampleitem) to SchemaName (new_SampleItem) for CREATE operations.
714+
"""Convert logical name (new_sampleitem) to SchemaName (new_Sampleitem) for CREATE operations.
715715
716716
Use this ONLY when creating new entities where we control the SchemaName.
717717
For existing entities, use _get_entity_schema_name() to get the actual SchemaName from server.

tests/unit/data/test_naming_normalization.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
from tests.unit.test_helpers import (
1414
TestableClient,
1515
MD_ACCOUNT,
16-
MD_SAMPLE_ITEM,
17-
make_entity_create_headers
16+
MD_SAMPLE_ITEM
1817
)
1918

2019
# ============================================================================
@@ -331,15 +330,14 @@ def test_get_entity_by_logical_normalization():
331330

332331
def test_create_table_normalizes_logical_name():
333332
"""Test that _create_table normalizes the logical name."""
334-
guid = "11111111-2222-3333-4444-555555555555"
335333
responses = [
336334
(200, {}, {}), # POST to create entity
337335
(200, {}, {"value": [MD_ENTITY_BY_LOGICAL]}), # GET entity by logical with Consistency: Strong
338336
]
339337
c = TestableClient(responses)
340338

341339
# Create with mixed case - _create_table takes schema dict, not individual params
342-
result = c._create_table(
340+
c._create_table(
343341
logical_name="NEW_SAMPLEITEM",
344342
schema={"new_field1": "string"}, # Dict of column_name -> type
345343
solution_unique_name=None
@@ -518,7 +516,6 @@ def test_create_with_one_casing_crud_with_another():
518516
)
519517

520518
# 3. GET entity set with different casings - first call populates cache
521-
calls_before = len(c._http.calls)
522519
entity_set1 = c._entity_set_from_logical("New_Product")
523520
calls_after_first = len(c._http.calls)
524521

tests/unit/test_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, responses, org_url="https://org.example", config=None):
7373
super().__init__(DummyAuth(), org_url, config)
7474
self._http = DummyHTTPClient(responses)
7575

76-
def _convert_labels_to_ints(self, logical_name, record):
76+
def _convert_labels_to_ints(self, logical_name, record): # pragma: no cover - test shim
7777
"""Test shim - no-op conversion for simplicity."""
7878
return record
7979

0 commit comments

Comments
 (0)