Skip to content

Commit

Permalink
🔧(opendata) update latest statuses query
Browse files Browse the repository at this point in the history
Now that we have real world statuses, we can provide a relevant
timescaleDB based database query.
  • Loading branch information
jmaupetit committed Jan 8, 2025
1 parent 31b37fa commit 5fd721d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/opendata/data7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ default:
datasets:
- basename: statuses
query: >-
WITH
pdc_status AS (
SELECT
LAST (Status.id, Status.horodatage) AS latest_id
FROM
PointDeCharge
INNER JOIN Status ON Status.point_de_charge_id = PointDeCharge.id
GROUP BY
PointDeCharge.id_pdc_itinerance
)
SELECT
PointDeCharge.id_pdc_itinerance,
Status.etat_pdc,
Expand All @@ -19,6 +29,14 @@ default:
FROM
Status
INNER JOIN PointDeCharge ON Status.point_de_charge_id = PointDeCharge.id
WHERE
Status.id IN (
SELECT
latest_id
FROM
pdc_status
)
ORDER BY Status.horodatage DESC
- basename: statiques
query: >-
WITH
Expand Down

0 comments on commit 5fd721d

Please sign in to comment.