Skip to content

Commit df2248c

Browse files
Merge pull request #37 from openclimatefix/optional-read-pv-yiled
make pv systems optional in pv yield read
2 parents 4c350fa + e308965 commit df2248c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nowcasting_datamodel/read/read_pv.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def get_latest_pv_yield(
115115

116116
def get_pv_yield(
117117
session: Session,
118-
pv_systems_ids: List[int],
118+
pv_systems_ids: Optional[List[int]] = None,
119119
start_utc: Optional[datetime] = None,
120120
end_utc: Optional[datetime] = None,
121121
) -> Union[List[PVYieldSQL], List[PVSystemSQL]]:
@@ -132,7 +132,8 @@ def get_pv_yield(
132132
query = query.join(PVSystemSQL)
133133

134134
# select only th pv systems we want
135-
query = query.where(PVSystemSQL.id.in_(pv_systems_ids))
135+
if pv_systems_ids is not None:
136+
query = query.where(PVSystemSQL.id.in_(pv_systems_ids))
136137

137138
# filter on start time
138139
if start_utc is not None:

0 commit comments

Comments
 (0)