Summary
PlexosDB.update_property() is a documented public method but currently always raises NotImplementedError in plexosdb/db.py. This blocks updating existing scenario-bound properties such as Line Wheeling Charge and Wheeling Charge Back; consumers must currently delete and recreate records.
Reproduction
from plexosdb import ClassEnum, PlexosDB
database = PlexosDB.from_xml("model.xml")
database.update_property(
"line_a",
"Wheeling Charge",
10.0,
object_class=ClassEnum.Line,
scenario="default",
)
Expected: update the matching existing t_data.value record.
Actual: NotImplementedError at plexosdb/db.py:update_property.
Implementation Plan
- Preserve the existing public signature and add complete NumPy-style documentation consistent with
get_object_properties() and update_object(), including selection semantics and raised errors.
- Resolve the effective collection and parent class using the same default-resolution behavior used by property readers (
get_default_collection / ClassEnum.System where applicable). Validate the requested property with the existing property-ID resolution helpers.
- Resolve the target object and membership context with existing public/internal project helpers, then obtain matching
data_id values through get_object_data_ids() (or the equivalent existing query path), honoring all existing selectors: object_class, object_name, property_name, scenario, band, collection, and parent_class.
- Require exactly one matching data record. Raise the package’s established not-found/ambiguity error rather than silently updating several bands, scenarios, or relationship properties.
- Follow the style of
update_object() for the write: parameterized SQL only, updating Schema.Data / t_data with SET value = ? WHERE data_id = ?, execute through the database manager, and assert/raise consistently on a failed execution. Do not alter metadata such as date range, text, datafile, variable, or timeslice tags.
- Implement
update_properties() separately or defer it explicitly; it should not be coupled to this single-record implementation unless its transactional input contract is designed and tested.
Test Plan
Add focused pytest coverage in tests/test_plexosdb_list_update_methods.py (or the project’s closest property-update test module):
- Update a default System-Generator property and verify its value through
get_object_properties().
- Update a System-Line
Wheeling Charge and Wheeling Charge Back under the default scenario, then verify both scenario-bound records changed and no duplicate data rows were created.
- Verify selectors isolate the target scenario and band when otherwise identical property rows exist.
- Verify a relationship property respects explicit
collection and parent_class.
- Verify missing object/property/data selection produces the project-standard exception and does not mutate another record.
- Verify the SQL values are bound parameters by exercising names/values requiring normal SQLite parameter handling.
Context
Observed with plexosdb 1.5.0 while generating PLEXOS 10 XML variants. The existing implementation at db.py lines 4339-4353 is a stub, while nearby update_object() demonstrates the repository’s parameterized UPDATE style.
Summary
PlexosDB.update_property()is a documented public method but currently always raisesNotImplementedErrorinplexosdb/db.py. This blocks updating existing scenario-bound properties such asLineWheeling ChargeandWheeling Charge Back; consumers must currently delete and recreate records.Reproduction
Expected: update the matching existing
t_data.valuerecord.Actual:
NotImplementedErroratplexosdb/db.py:update_property.Implementation Plan
get_object_properties()andupdate_object(), including selection semantics and raised errors.get_default_collection/ClassEnum.Systemwhere applicable). Validate the requested property with the existing property-ID resolution helpers.data_idvalues throughget_object_data_ids()(or the equivalent existing query path), honoring all existing selectors:object_class,object_name,property_name,scenario,band,collection, andparent_class.update_object()for the write: parameterized SQL only, updatingSchema.Data/t_datawithSET value = ? WHERE data_id = ?, execute through the database manager, and assert/raise consistently on a failed execution. Do not alter metadata such as date range, text, datafile, variable, or timeslice tags.update_properties()separately or defer it explicitly; it should not be coupled to this single-record implementation unless its transactional input contract is designed and tested.Test Plan
Add focused pytest coverage in
tests/test_plexosdb_list_update_methods.py(or the project’s closest property-update test module):get_object_properties().Wheeling ChargeandWheeling Charge Backunder thedefaultscenario, then verify both scenario-bound records changed and no duplicate data rows were created.collectionandparent_class.Context
Observed with
plexosdb1.5.0 while generating PLEXOS 10 XML variants. The existing implementation atdb.pylines 4339-4353 is a stub, while nearbyupdate_object()demonstrates the repository’s parameterizedUPDATEstyle.