Files
bambuddy/backend
maziggy 9f6437244d fix(energy): strip tz from list params so snapshot INSERTs work on Postgres
The hourly smart plug energy snapshot loop introduced with #941 crashed
  every cycle on PostgreSQL installs with:

    asyncpg.DataError: invalid input for query argument $2:
    datetime.datetime(..., tzinfo=datetime.timezone.utc)
    (can't subtract offset-naive and offset-aware datetimes)

  The engine has a `before_cursor_execute` hook that strips tzinfo from
  aware datetimes before they reach asyncpg (all schema datetime columns
  are TIMESTAMP WITHOUT TIME ZONE). The hook's `_strip_container` handled
  dict and tuple parameter containers but fell through `list` unchanged.

  When SQLAlchemy's insertmanyvalues feature batches two or more rows into
  a single INSERT ... SELECT FROM (VALUES ...) statement, it passes the
  positional params as a flat `list`, so the tz-aware datetimes survived
  the hook and reached asyncpg.

  Added a list branch that mirrors the tuple one. No schema change needed
  — the column stays naive UTC like the rest of the codebase. SQLite was
  never affected.
2026-04-11 12:19:27 +02:00
..
2025-11-28 10:23:59 +01:00