Skip to content

Commit 2ae2bf0

Browse files
committed
Ensure cloud signal columns exist before insert
1 parent 8228ab7 commit 2ae2bf0

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

universal-telemetry-software/cloud-sync/sync.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,9 @@ def sync(self, progress_cb: Optional[Callable[[int, int], None]] = None) -> dict
277277
if col_names is None:
278278
col_names = [d.name for d in read_cur.description]
279279
signal_cols = [c for c in col_names if c not in _FIXED_COLS]
280-
281-
# Collect signal names present in this batch (non-null columns vary)
282-
batch_signal_names: Set[str] = set()
283-
for row in rows:
284-
row_dict = dict(zip(col_names, row))
285-
for sc in signal_cols:
286-
if row_dict.get(sc) is not None:
287-
batch_signal_names.add(sc)
288-
289-
self._ensure_cloud_signal_columns(cloud_conn, batch_signal_names, known_signals)
280+
# Ensure all local signal columns exist in cloud upfront —
281+
# batches may have nulls for columns that exist in the schema.
282+
self._ensure_cloud_signal_columns(cloud_conn, set(signal_cols), known_signals)
290283

291284
# Build INSERT for the fixed + all signal columns
292285
all_cols = ["time", "message_name", "can_id"] + signal_cols

universal-telemetry-software/deploy/docker-compose.macbook-base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
- ENABLE_VIDEO=false
3838
- ENABLE_AUDIO=false
3939
- SET_TIME_ENABLED=false
40-
- ENABLE_TIMESCALE_LOGGING=true
40+
- ENABLE_TIMESCALE_LOGGING=${ENABLE_TIMESCALE_LOGGING:-false}
4141
- POSTGRES_DSN=postgresql://wfr:wfr_password@timescaledb:5432/wfr
4242
- TIMESCALE_TABLE=${TIMESCALE_TABLE:-wfr26base}
4343
- DBC_FILE_PATH=/app/active.dbc

0 commit comments

Comments
 (0)