docs / data / mysql

MySQL Database (pidb)

Static reference tables from the schools MySQL database. Contains building metadata, room details, sensor mappings, device inventories, and energy profiles. Imported into Silver as TEXT columns (type casting done in Gold).

connection

Host10.130.25.152
Port3306
Databasepidb
Userstudent (read-only)
AccessSchool network only (VPN required)
FrequencyStatic — queried on-demand for snapshots

import method

The script import_mysql_to_silver.py connects to both MySQL (source) and PostgreSQL (target). For each table in the mapping, it reads all rows from MySQL, drops and recreates the Silver table (all TEXT columns for safe import), and inserts all rows. Idempotent: safe to re-run at any time.

All TEXT columnsEvery column is imported as TEXT to avoid type conversion errors. Proper types (INTEGER, FLOAT, BOOLEAN) are applied in the Gold layer during dimension population. This is intentional.

imported tables (10)

MySQL tableSilver tabledescriptionrows
buildingsdim_buildingsApartment metadata — name, location, building year, type2
buildingtypedim_building_typesBuilding type lookup (Maison / Appartement)2
roomsdim_roomsRoom details — name, sensor count, orientation, surface (m²)~20
sensorsdim_sensorsSensor-to-room mapping — IP address, room ID, type~30
devicesdim_devicesAppliance inventory — name, room, type (fridge, washer, etc.)~40
profilereferenceref_energy_profilesReference energy consumption kWh/year by appliance typesmall
profileref_power_snapshotsHistorical power consumption snapshots over time~500
parametersref_parametersThreshold configurations per building (temp, humidity limits)small
parameterstyperef_parameters_typeParameter type lookup tablesmall
dierrorslog_sensor_errorsSensor error logs — null readings, communication failuresvaries

skipped tables (GDPR / irrelevant)

GDPRTables containing personal data (names, emails, passwords, phone numbers) are explicitly excluded from the import. This decision is documented and intentional.

table(s)reason for skipping
usersGDPR — contains names, emails, passwords, phone numbers
actions, achievements, badgesGamification features — not relevant for sensor analytics
events, eventsgeneric, eventsignoreApp-generated alerts — not raw sensor data
categoriesOnly useful with the events table (skipped)
userrelationshipsApp configuration — no analytical value

usage in Gold layer

These reference tables enrich the Gold star schema:

dim_buildings → enriches gold.dim_apartment with building_name and building_id

dim_rooms → could enrich gold.dim_room with room_id, orientation, surface area (future)

dim_sensors → provides sensor IP-to-room mapping for device identification

dim_devices → appliance inventory for device-level analytics

ref_energy_profiles → reference kWh/year for energy benchmarking

ref_parameters → threshold configs for anomaly detection

log_sensor_errors → feeds gold.fact_device_health_day (error_count column)