• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-py / 41662786735 / 27
98%
main: 98%

Build:
DEFAULT BRANCH: main
Ran 03 Nov 2026 03:23PM UTC
Files 17
Run time 2s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Nov 2026 03:20PM UTC coverage: 98.087%. Remained the same
41662786735.27

push

github

web-flow
fix(postgrest): accept generated typeddict types in insert, upsert and update (#1939)

## What

Fixes #1443. SDK-831.

`insert`, `upsert` and `update` were typed to take `JSON`, so the
`Insert` and `Update` TypedDicts generated by `supabase gen types --lang
python` failed type checking. This PR fixes both the types and the
runtime serialization.

## Why the previous attempt was not enough

PR #1514 added `datetime` and `UUID` to the `JSON` alias. That has two
problems:

1. mypy (and pyright) treat a TypedDict as a `Mapping[str, object]`
only, never as `Mapping[str, <recursive alias>]`, so even a widened
`JSON` still rejects generated TypedDicts. I verified this against a
CLI-style TypedDict.
2. The body was sent with httpx's `json=`, which uses `json.dumps`, so
`datetime`, `UUID` and the other generated types raised `TypeError` at
request time.

## Changes

- New `RequestBody` type alias, `JSON | Mapping[str, object] |
Sequence[Mapping[str, object]]`, used by `insert`, `upsert` and `update`
(async and sync). It is a superset of the old `JSON` annotation, so
existing callers keep type-checking.
- Request bodies are now encoded by a private `_encode_json_body` helper
in `base_request_builder` and sent as `content=`, keeping the same
compact UTF-8 output httpx produced (`ensure_ascii=False`,
`allow_nan=False`). On top of plain JSON it encodes every non-JSON type
the generator emits:

  | Python type                | Encoded as                         |
  | -------------------------- | ---------------------------------- |
  | `datetime.datetime`/`date` | ISO 8601 string                    |
  | `datetime.time`            | ISO 8601 string                    |
  | `uuid.UUID`                | canonical string                   |
  | `bytes`                    | `\x` hex string (PostgreSQL bytea) |

  Any other unsupported type still raises `TypeError`, as before.
- `Content-Type: application/json` is set when a body is sent and the
caller has not set one.
... (continued)

1077 of 1098 relevant lines covered (98.09%)

0.98 hits per line

Source Files on job run-ubuntu-latest-3.13-realtime - 41662786735.27
  • Tree
  • List 17
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 41662786735
  • 1ae57b89 on github
  • Prev Job for on main (#41662624502.9)
  • Next Job for on main (#41667435053.9)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc