k.rennerandClaude Opus 4.7 614533c553 influxdb(seed): filter the colliding "source" field before pivot
Per-day chunking from 106d551 ran successfully for 39 minutes (got
through 2018-01-01 to 2024-06-03) before hitting:

  runtime error @3:13-3:83: pivot: value "source" appears in a column
  key column, but a column named "source" already exists; consider
  renaming "source" to something else before pivoting

HA writes `source` as both a tag (integration name, e.g. "Home
Assistant") AND, on some entities, as a field (entity attribute) on
the same measurement. pivot() turns _field values into column names,
so when it processes a row with _field=source it tries to add a
"source" column — but the existing tag-derived "source" column is
already there. Pivot errors out.

Drop the field via `filter(fn: (r) => r._field != "source")` before
pivot. Tag `source` is preserved (more useful — present on every
point, drives Grafana datasource filtering); the field `source` is
lost (rare, unique-per-entity attribute). Net data shape stays
queryable for HA's downstream consumers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 02:35:28 +02:00
S
Description
No description provided
39 MiB
master
Latest
2026-01-31 15:05:31 +00:00
Languages
Go 35.7%
Shell 24.3%
Python 22.4%
Jinja 5.1%
HCL 4.8%
Other 7.6%