Collect the daily electricity consumption of French regions
Find out how to load 13 years of regional electricity consumption, add real-time data every morning and model both in an hourly SQL view for a forecast
Objective
This guide walks you through building the data a regional electricity forecast needs: 13 years of consumption history for the 12 regions of mainland France, completed every morning with the latest data published by the French transmission system operator, RTE. You load the history from a file with a File Upload source, connect the real-time data with an HTTP REST source, date and deduplicate each collection with Data Processing Engine, then merge both into an hourly view. Everything in this part happens in the Data Platform interface and in SQL.
By the end you will have two tables, eco2mix_regional_history and eco2mix_regional_realtime (the second one updated every morning by a scheduled workflow), and the view regional_consumption_hourly: one row per region and per hour, from January 2013 to today. The second part of the guide, Forecast the electricity consumption of each region every day with PySpark, trains a forecast model on this view in a notebook, then runs it every morning as a scheduled job.
Requirements
To follow this guide you need:
- a Data Platform project.
- the history file below, exported from the public ODRÉ API. The real-time API is public too: neither needs an account or a key.
Save the file as eco2mix_regional_history.parquet: this guide uses that name.
About the data: éCO2mix regional consumption by RTE, published by Open Data Réseaux Énergies (ODRÉ) under the Licence Ouverte 2.0: the consolidated and definitive data for the history and the real time data for the daily collection.
When you reuse these data, mention their source and the date of their last update.
We recommend completing the Getting Started guides first. This guide assumes you are comfortable with the main components of Data Platform.
What you will build
Instructions
Step 1: Loading the regional history
The history covers the 12 regions of mainland France, half hour by half hour. Corsica is not part of the dataset.
The file listed in the Requirements is the export of the ODRÉ dataset, limited to five columns, with times in UTC:
The download can take a few minutes. The figures in this guide come from an export dated 20 October 2026, which ends on 31 August 2026: a later export covers more months, and the real-time data takes over after its last row.
Creating the source
- Open Connectors > Sources and create a new source of type File Upload.
- Name it
eco2mix_regional_history. - In the Files section, drop
eco2mix_regional_history.parquetor use click here to upload. - Click Create.
Checking the attributes
- Open Connectors > Analyzer.
- Select the source
eco2mix_regional_history, theneco2mix_regional_history.parquet. - Click Extract metadata.
The Analyzer detects the types on a sample of 1,000 rows. Check them now: they become the types of the attributes of the table.
The file is sorted from the most recent row to the oldest: in the export of 20 October 2026, its first row is 2026-08-31 21:30 UTC, and the sample of 1,000 rows covers a little under two days of late August 2026. The Explorer gives the full picture once the table is loaded.
Creating the table
- Open Lakehouse Manager > Tables and click New table > Create from a Connectors source.
- Select
eco2mix_regional_history.parquetfrom the sourceeco2mix_regional_history, then click Next. - Name the table
eco2mix_regional_history, keep the datasetdefault_dataset, and keep the 3 options turned on: Automatically build the table, Automatically load the table once and Automatically generate Load action for later. - Click Create, then wait for the first load to finish.
Checking the history
In Lakehouse Manager > Explorer, run:
With the export of 20 October 2026:
What these figures say:
- 12 regions, every half hour, from 1 January 2013 to 31 August 2026, Paris time. The first row,
2012-12-31 23:00UTC, is midnight in Paris. - 336 duplicates (
rowsminusdistinct_region_timestamps). The dataset follows Paris time: on the day clocks go forward in spring, the hour that does not exist in Paris time appears twice in UTC, that is, two half hours per region each spring. In autumn, the hour that occurs twice in Paris time is missing in UTC. The hourly view of Step 4 averages all the points of an hour, duplicates included. - 24 empty consumptions: for each region, the first half hour of 1 January 2013 and of 1 January 2026, where a new series starts (definitive data, then consolidated data).
Step 2: Connecting the real-time data
The real-time dataset only keeps recent months: older months move to the consolidated dataset. The export of 20 October 2026 stops on 31 August 2026, and the real-time data takes over from 1 September.
Creating the source
-
Open Connectors > Sources and create a new source of type HTTP REST.
-
Name it
eco2mix_realtime. -
In Base URL, enter
https://odre.opendatasoft.com/api/explore/v2.1/. The API is public: keep Authentication mode set to None, then click Connect. -
In Endpoints to connect, click Add an endpoint and fill in the endpoint:
-
Click Confirm.
-
Click Create.
The source lists one endpoint,
regional.json.
Two choices matter here:
- The export endpoint, not
records: therecordsendpoint returns a limited number of rows per call; the export endpoint returns the whole dataset at once. - No date filter: the real-time dataset only holds recent data anyway, and each collection overlaps the previous one. Step 3 removes the overlap.
Checking the attributes
In Connectors > Analyzer, select the source eco2mix_realtime, then regional.json, and click Extract metadata. You get the same types as for the history: code_insee_region Double, date_heure DateTime with the same blueprint, consommation Double. Unlike the history file, this JSON is sorted from the oldest row to the most recent.
Creating the table from the history table
The real-time table has the same columns as the history, plus the time of each collection. Start from a copy of the history table:
- Open Lakehouse Manager > Tables, hover over the row of
eco2mix_regional_historyand click its Duplicate icon. The Create new empty table window opens with the nameeco2mix_regional_history_copy. - Rename the table
eco2mix_regional_realtime, keep the datasetdefault_datasetand click Create. - Open the table
eco2mix_regional_realtime, then its Schema tab. - Click New attribute, name it
collected_at, select the data type Datetime and click Save. - Click Build.
Note: the copy keeps the identifier field of the original table, date_heure. Leave it as it is: in this guide, the Deduplicate action of Step 3 handles the key of a row (the region and the quarter hour).
Creating the Load action
- Open Data Processing Engine > Actions, click New action and select the Load action.
- In Sources, select
regional.jsonfromeco2mix_realtime. In Destination, selecteco2mix_regional_realtimefromdefault_dataset. - The five attributes map to the attributes of the same name. Leave
collected_atwithout a source: the SQL action of Step 3 fills it. - Rename the action
Load regional realtime. - Click Create, then Run.
Checking the real-time data
In the Explorer, run:
On 23 November 2026, the table holds 96,768 rows: 12 regions × 96 quarter hours × 84 days, from 2026-08-31 22:00 UTC, right after the last row of the history, to the end of the current day. The real-time data is published by quarter hour, and lists every quarter hour of the current day in advance: the ones not measured yet have an empty consumption. It has no row for tomorrow.
Step 3: Keeping one row per quarter hour
Each collection loads all the recent weeks again. To keep one row per region and quarter hour, you date each collection, then keep the most recent row of each quarter hour.
Dating each collection
Create an SQL action that dates the rows that have just been loaded.
-
In Data Processing Engine > Actions, click New action and select the SQL action.
-
Name it
Stamp regional collection. -
In the Tables panel, click the copy icon of
eco2mix_regional_realtime: an SQL action needs the full namecatalog.schema.table, and the catalog name,db_<id>_default_dataset, is specific to your project. -
Paste the query below, with that full name in place of
<catalog>.default_dataset.eco2mix_regional_realtime: -
Click Validate. Validation is a dry run: it checks the query without changing the table.
-
Click Create.
Seeing the Load action append
-
Run
Stamp regional collection. -
Run
Load regional realtimeagain. -
In the Explorer, run:
The table now holds twice as many rows: 193,536, of which 96,768 stamped by the first collection and 96,768 not stamped yet. The Load action appends every row it reads: each collection is kept, and the next step keeps the most recent row of each quarter hour.
Keeping the most recent row
-
Run
Stamp regional collectionagain: the new rows get a more recent collection time. -
In Data Processing Engine > Actions, click New action and select the Deduplicate action.
-
Fill in the action:
The action notes that this key differs from the identifier fields of the table: this is expected, since the key here is the region and the quarter hour.
-
Click Scan: it estimates, without changing anything, how many rows the key would remove. It finds 96,768 rows to remove, one per region and quarter hour.
-
Click Create. The action is named
Deduplicate - eco2mix_regional_realtime. Run it.
Run the count query again: the table is back to 96,768 rows, all stamped.
Why append then deduplicate, rather than empty the table and reload it? RTE removes older months from the real-time dataset, and the history file stops at the end of the last consolidated month. Emptying the table before each load would lose the months that are no longer in the real-time data and not yet in the history.
Step 4: Modelling the data in hours
The view regional_consumption_hourly merges the history and the real-time data into one row per region and per hour.
-
Open Lakehouse Manager > Views and click New View.
-
Name the view
regional_consumption_hourlyand select the datasetdefault_dataset. -
Enter the definition below. Write table names only: the platform resolves their catalog and schema.
-
Click Create.
The rules behind this view:
- The history comes first: the real-time data is only read after the last row of the history.
- One hour is the average of its points, in UTC: two half hours in the history, four quarter hours in the real-time data. Staying in UTC avoids the autumn trap, when two UTC hours fall on the same Paris hour.
- Portable SQL: Trino reads this view in the Explorer, and Spark reads it in the notebook and in the job of the second part. The view only uses SQL both engines know: the functions, operators and types specific to Trino, such as
with_timezone,AT TIME ZONE,timestamp(6)orday_of_week, stay out of it, and Paris time is computed where the view is read. - The region code is a
BIGINT, a type both engines share. - Table names only: the platform resolves the catalog and the schema of the tables, for Trino and for Spark alike.
Checking the view
In the Explorer, a view is prefixed with its dataset:
On 23 November 2026, each region has 121,786 hours, from 2012-12-31 23:00 to 2026-11-23 22:00 UTC. 121,776 of them are measured, 121,777 in Bourgogne-Franche-Comté: the remaining 10, or 9, are the hours of the current day not measured yet.
Step 5: Scheduling the collection
Stopping the workflow on failure
If one action of the collection fails, the next ones must not run on incomplete data. For each of the three actions, Load regional realtime, Stamp regional collection and Deduplicate - eco2mix_regional_realtime:
- Open the action, then its Preferences tab.
- In the Timeout options section, turn on Stop workflow on failure.
Creating the workflow
-
Open Data Processing Engine > Workflows and click New workflow.
-
Name it
Daily realtime collection. -
In the workflow builder, click Add your first action, then select
Load regional realtimein the Action list of the side panel. -
Click the + of
Load regional realtime, then Add action after, and selectStamp regional collection. -
Click the + of
Stamp regional collection, then Add action after, and selectDeduplicate - eco2mix_regional_realtime. -
Click Create.
Each action waits for the one before it: in its side panel, the Dependencies tab shows Runs after and the previous action. Actions that do not wait for each other can run at the same time, which is why each one is added with Add action after rather than Add parallel action.
Scheduling it
In the Preferences tab of the workflow, in the Triggers section, click Add and fill in the time-based trigger:
Click Confirm.
The workflow runs every day at 06:17 UTC: schedules are in UTC, while the interface shows times in the time zone of your browser, 07:17 in winter and 08:17 in summer for a browser set to French time.
Checking a run
Click Run to start a first collection now. It takes a little over a minute. The logs show a warning on collected_at, which has no mapping attribute in the Load action: this is expected, since the SQL action fills it.
What you have built
You have 13 years of regional consumption, completed every morning by a three-step workflow that loads, dates and deduplicates the real-time data of RTE. You also have a view that merges both into one row per region and per hour, readable by Trino and by Spark.
The next part, Forecast the electricity consumption of each region every day with PySpark, explores this view in a notebook, trains one forecast model per region with PySpark, then turns the notebook into a scheduled Custom PySpark job, with its logs, its Spark History, its lineage and a daily check of its accuracy.
Go further
For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analysed by our experts.
Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated Discord channel.
If you need support with your OVHcloud services, create a request in our Help Centre.
Join our community of users.