DATONS_API_KEY=your_key_here
The client reads from either source automatically:
```python
from datons import Client
client = Client() Explore the data model before writing queries. metadata() returns the schema, available programs, and date range:
meta = client.esios.metadata() Find units, companies, or technologies with fuzzy search:
client.esios.search("trillo") # → finds TRL1, C.N. TRILLO
client.esios.search("iberdrola") # → finds company names and units
client.esios.search("solar") # → finds Solar fotovoltaica, Solar PV... Three tables are available at different granularities: operational_data_15min (raw 15-min intervals), agg_hourly, and agg_daily (pre-aggregated). Use the coarsest table that fits your query — agg_daily is orders of magnitude faster for monthly or yearly analysis.
Analysis by unit: following one power plant
The per-unit view is where I90 data becomes powerful. One SQL query traces a single power plant through the entire market cascade:
df = client.esios.query("""
SELECT program, round(sum(energy), 1) AS energy
FROM operational_data_15min
WHERE unit = 'BAHIAB'
AND toStartOfHour(datetime) = toDateTime('2024-12-04 16:00:00')
GROUP BY program
ORDER BY program
""") 
BAHIAB is a combined cycle gas turbine. At this hour, it scheduled 730 MWh in the day-ahead market — then PHF1 (the first intraday session) added 810 MWh on top. The plant more than doubled its position before delivery. Small corrections from RR and BT, and a net result of 1,526 MWh.
This is gas’s signature move: schedule conservatively, then add volume in intraday. Try the same query with a nuclear unit like TRL1 — you’ll see a flat line. Each technology has a completely different waterfall shape.
Analysis by company: Endesa’s generation portfolio
Zoom out from a single unit to an entire company. What does Spain’s largest generator look like from a technology perspective?
df = client.esios.query("""
SELECT technology,
round(sum(total_energy) / 1e3, 0) AS gwh
FROM agg_daily
WHERE program = 'PDBF'
AND day BETWEEN '2024-03-01' AND '2025-02-28'
AND company_name LIKE '%ENDESA%'
AND technology IS NOT NULL
GROUP BY technology
ORDER BY gwh DESC
""") 
The two panels reveal both sides of Endesa’s business. On the right, generation: nuclear dominates, followed by large hydroelectric and combined cycle. On the left, retail: their free-market retailers buy far more energy than their plants produce. Endesa is a net buyer in the day-ahead market — a fact that’s invisible if you only look at generation.
The search() function helps find the exact company name. Company names in I90 data don’t always match trade names — search("endesa") reveals “ENDESA GENERACIÓN, S.A.” as the right filter.
Analysis by technology: the generation mix
The system-wide view shows how Spain’s electricity mix changes through the seasons:
df = client.esios.query("""
SELECT technology,
toStartOfMonth(day) AS month,
round(sum(total_energy) / 1e3, 0) AS energy_gwh
FROM agg_daily
WHERE program = 'PDBF'
AND day BETWEEN '2024-03-01' AND '2025-02-28'
AND technology IN ('Eólica terrestre', 'Nuclear',
'Solar fotovoltaica', 'Hidráulica UGH',
'Ciclo Combinado', 'Gas Natural Cogeneración')
GROUP BY technology, month
ORDER BY technology, month
""") 
The seasonal rhythm is immediate. Solar peaks in summer and nearly disappears in winter. Wind is strongest in spring and autumn. Nuclear runs flat year-round — the baseload backbone. Hydro fluctuates with rainfall. Combined cycle fills the gaps.
This query runs against agg_daily — the pre-aggregated table. It processes a full year of data across all generation technologies in under a second. The same analysis on raw 15-minute data would scan billions of rows.
Deep dive: who gets curtailed in PDVP?
The real analytical power comes from crossing dimensions. PDVP (technical constraints) is where REE intervenes to maintain grid security. One query reveals who benefits and who pays:
df = client.esios.query("""
SELECT technology,
round(sum(total_energy) / 1e3, 1) AS gwh
FROM agg_daily
WHERE program = 'PDVP'
AND day BETWEEN '2024-03-01' AND '2025-02-28'
AND technology IS NOT NULL
GROUP BY technology
ORDER BY gwh ASC
""") 
The asymmetry is striking. Combined cycle gas receives massive upward redispatch — REE calls on gas when constrained zones need more power. Every other technology is curtailed. Wind bears the heaviest cuts, followed by solar and hydro.
This is the kind of cross-program, cross-technology analysis that was practically impossible with raw I90 files. Each program was a separate download, each technology had to be filtered manually. With a unified SQL table, it’s one query.
What’s next
Four SQL queries. Four perspectives on Spain’s electricity market that would each take hours of manual data processing. The unified I90 table in python-datons makes this kind of analysis routine.
The library covers I90 settlement data today — every generating unit, every market program, every 15-minute interval since 2023. As the datons platform grows, new datasets will be accessible through the same Client() interface.
pip install datons Full documentation and API key request at datons.com/apps/esios-data/docs.
Keep reading
Related articles you might enjoy

Who generates what in Spain? A company-by-company view of the electricity market
Endesa, Iberdrola, Repsol, Gas Natural — each company has a different generation portfolio. I90 settlement data reveals their strategies across market programs.
Read
Inside Spain's electricity market programs: who participates in each
PDBF, PDVP, PHF1, RR, BT — each market program has its own logic, actors, and economics. I90 data shows who participates in each and how much they earn.
Read
How a combined cycle plant navigates Spain's electricity markets
Follow Algeciras 3 through all 8 market programs in a single day — from day-ahead scheduling to real-time balancing — with real I90 settlement data.
Read