Skip to content

Show a data source's account and the sensors it wrote to - #2401

Merged
BelhsanHmida merged 2 commits into
mainfrom
feat/show-data-source-sensors
Aug 6, 2026
Merged

Show a data source's account and the sensors it wrote to#2401
BelhsanHmida merged 2 commits into
mainfrom
feat/show-data-source-sensors

Conversation

@BelhsanHmida

Copy link
Copy Markdown
Contributor

Description

  • Add a --show-sensors flag to flexmeasures show data-sources, listing the sensors which hold data recorded by a source, together with the asset each sensor belongs to.
  • Require --id for that flag: DataSource.sensors scans the timed_belief table, so we do not want to run it once per source in a full listing. Without --id the command exits with a UsageError.
  • Add an Account ID column to the table, bringing the CLI in line with what GET /api/v3_0/sources already returns for the same object.
  • Added changelog item in documentation/changelog.rst (and in documentation/cli/change_log.rst)

Look & Feel

$ flexmeasures show data-sources --id 1312 --show-sensors
type: forecaster
==========
  ID  Name          Account ID    User ID    Model                 Version
----  ------------  ------------  ---------  --------------------  ---------
1312  FlexMeasures                           TrainPredictPipeline


Sensors with data from data source 1312:

  ID  Name    Unit    Asset
----  ------  ------  ----------------
 913  power   kW      Campus (ID: 242)

A source which recorded nothing says so, rather than printing an empty table:

$ flexmeasures show data-sources --id 42 --show-sensors
...
No sensors hold data recorded by data source 42.

And the flag is refused for a full listing:

$ flexmeasures show data-sources --show-sensors
Usage: flexmeasures show data-sources [OPTIONS]
Try 'flexmeasures show data-sources --help' for help.

Error: --show-sensors requires --id.

--show-sensors combines with --show-attributes.

Related Items

Closes #2400

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida BelhsanHmida self-assigned this Aug 5, 2026
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida
BelhsanHmida requested a review from nhoening August 5, 2026 23:18
@read-the-docs-community

Copy link
Copy Markdown

@nhoening nhoening left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nhoening nhoening added this to the 1.0.0 milestone Aug 6, 2026
@BelhsanHmida
BelhsanHmida merged commit db77c6e into main Aug 6, 2026
13 checks passed
@BelhsanHmida
BelhsanHmida deleted the feat/show-data-source-sensors branch August 6, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show data-sources: show which sensors a source wrote to, and its account

2 participants