Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fb79819
feat: implement update logic for properties in plexos system
mcllerena Aug 12, 2026
e78862a
docs: add corresponding definition and examples for new functions
mcllerena Aug 12, 2026
b195558
fix: resolve prek issues
mcllerena Aug 12, 2026
8b35fd3
fix: address roll back domain-validation failures
mcllerena Aug 13, 2026
c5e4098
fix: avoid n+1 lookups in bulk updates
mcllerena Aug 13, 2026
436daba
fix: reuse shared property-context for crud operations
mcllerena Aug 13, 2026
75dea8d
fix: reuse function on context correctly
mcllerena Aug 13, 2026
0d93497
fix: preserve explicit parent membership selection
mcllerena Aug 13, 2026
8a05c3e
fix: use existing public property readers in test handling
mcllerena Aug 13, 2026
11cea1f
docs: write missing docstring on files
mcllerena Aug 13, 2026
f363a4b
Merge branch 'main' into ml/functions
mcllerena Aug 31, 2026
982f670
docs: include missing docstrings and better approach for update function
mcllerena Aug 31, 2026
5c24d90
Merge branch 'main' into ml/functions
mcllerena Aug 31, 2026
8fc0a93
fix: batch membership resolution on large property updates
mcllerena Aug 31, 2026
4aface2
fix: resolve use of parent/child classes on collections
mcllerena Aug 31, 2026
1ceef72
fix: chunk bulk object validation into groups
mcllerena Aug 31, 2026
63fbeba
fix: implement band 1 fallback behavior for property updates
mcllerena Aug 31, 2026
0261c3c
docs: document bulk update properties correctly
mcllerena Aug 31, 2026
315b9c1
fix: update bulk scenario resolution for unknown scenario handling
mcllerena Aug 31, 2026
73afe89
fix: update batching bug on update properties
mcllerena Aug 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions docs/source/howtos/add_properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,53 @@ is added. When omitted, the default collection is selected, the parent class
defaults to `ClassEnum.System`, and the membership is resolved from the object
and collection.

## Updating Properties

Use `update_property` to change the value of an existing property without
removing its scenario, band, date, or text metadata:

```python
db.update_property(
"Generator1",
"Max Capacity",
125.0,
object_class=ClassEnum.Generator,
)
```

When a property has multiple bands, pass `band` to update only the matching
band. Pass `scenario` to update a scenario-specific value. If `scenario` is
omitted, only the base, non-scenario property is updated.

```python
db.update_property(
"Generator1",
"Heat Rate",
9.8,
object_class=ClassEnum.Generator,
band=2,
scenario="High Demand",
)
```

The `collection` and `parent_class` arguments can be supplied when the property
belongs to a non-default collection or membership:

```python
db.update_property(
"Generator1",
"Max Capacity",
130.0,
object_class=ClassEnum.Generator,
collection=CollectionEnum.Generators,
parent_class=ClassEnum.System,
)
```

The method raises `NotFoundError` when the object or matching property row does
not exist, and `NameError` when the property is invalid for the selected
collection.

## Bulk Adding Properties

For efficiency when adding many properties at once, use flat records. Each flat
Expand Down
42 changes: 42 additions & 0 deletions docs/source/howtos/bulk_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,48 @@ Key performance features:
- Direct SQL execution with prepared statements
- Automatic property enablement (sets `is_dynamic` and `is_enabled` flags)

## Bulk Updating Properties

Use `update_properties` to update several existing property values in one
transaction. Each update record uses the same selectors as `update_property`:
`object_name`, `property_name`, `new_value`, and `object_class`. The optional
`scenario`, `band`, `collection`, `parent_class`, and `parent_object_name`
fields narrow the matching property row. For relationship properties, use
`parent_object_name` with `parent_class` to select the property belonging to a
specific parent object.

Each bulk selector updates every matching data record. For a multi-band
property, omitting `band` updates all bands; provide `band` when only one band
should change. This differs from `update_property`, which requires its selectors
to identify exactly one data record and raises an error when multiple records
match.

```python
updates = [
{
"object_name": "Generator1",
"property_name": "Max Capacity",
"new_value": 125.0,
"object_class": ClassEnum.Generator,
},
{
"object_name": "Generator2",
"property_name": "Heat Rate",
"new_value": 9.8,
"object_class": ClassEnum.Generator,
"band": 2,
"scenario": "High Demand",
},
]

db.update_properties(updates)
```

All updates are committed together. If an update cannot find its object,
property, scenario, or requested band, the transaction fails and earlier updates
in the batch are rolled back. When `scenario` is omitted, the update targets the
base property rather than a scenario-tagged row.

### Handling Different Object Classes

You can process different types of objects separately:
Expand Down
Loading