Skip to content

Commit 069fc09

Browse files
committed
Updated create table statement to allow explicitly passing prefix in column names when desired
1 parent 52735bd commit 069fc09

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dataverse_sdk/odata.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,10 @@ def create_table(self, tablename: str, schema: Dict[str, str]) -> Dict[str, Any]
540540
for col_name, dtype in schema.items():
541541
# Use same publisher prefix segment as entity_schema if present; else default to 'new_'.
542542
publisher = entity_schema.split("_", 1)[0] if "_" in entity_schema else "new"
543-
attr_schema = f"{publisher}_{self._to_pascal(col_name)}"
543+
if col_name.lower().startswith(f"{publisher}_"):
544+
attr_schema = col_name
545+
else:
546+
attr_schema = f"{publisher}_{self._to_pascal(col_name)}"
544547
payload = self._attribute_payload(attr_schema, dtype)
545548
if not payload:
546549
raise ValueError(f"Unsupported column type '{dtype}' for '{col_name}'.")

0 commit comments

Comments
 (0)