Currently, if a field is referenced in the metrics_metadata sheet that does not exist in the metrics sheet, a vague error will be thrown during ingestion at our aggregation stage:
ERROR: cannot cast jsonb null to type numeric`
This occurs because we attempt to retrieve the value at the incorrect field location and instead retrieve null, which can not be turned into a number:
Currently, if a field is referenced in the
metrics_metadata
sheet that does not exist in themetrics
sheet, a vague error will be thrown during ingestion at our aggregation stage:This occurs because we attempt to retrieve the value at the incorrect field location and instead retrieve
null
, which can not be turned into a number:https://github.com/developmentseed/tecnico-energy-app/blob/995ea5d83313b94d8ef26a2d86f82e950f883240/prisma/migrations/20240313042750_add_functions/migration.sql#L101
We should either gracefully handle and ignore these incorrect fields or throw a more explicit error.