Metadata-Version: 2.5
Name: render-lab-tasks-render-postgres
Version: 0.1.0
Summary: render-postgres tasks for Render Workflows
Project-URL: Repository, https://github.com/render-lab/render-tasks-python
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: psycopg[binary]<4,>=3.2
Requires-Dist: render-lab-tasks-core<0.2,>=0.1.1
Requires-Dist: render==1.0.1
Description-Content-Type: text/markdown

# render-lab-tasks-render-postgres

Nine tasks: `postgres.query`, `execute`, `upsert`, `transaction`, `migrate`,
`setupVectorStore`, `upsertVectors`, `searchVectors`, and `deleteVectors`.
Import `render_lab_tasks_render_postgres.tasks` for explicit registration.
Each operation exports an injectable async `*_impl(ctx, input, *, deps=...)`.

Environment, read at first use:

| Variable | Meaning |
| --- | --- |
| DATABASE_URL | PostgreSQL URL, required; linked Render Postgres private URL is supported |
| DATABASE_SSL | `true`/`require` verifies TLS certificates, `no-verify` encrypts without verification; unset uses URL/driver options |

The async psycopg driver uses native `$1` positional placeholders. Each invocation
closes its connection. Transactions roll back on exceptions and cancellation;
there are no driver retries. Durable tasks retry three times with 1s exponential
backoff. Arbitrary SQL writes can repeat after an ambiguous commit failure.

Generated upserts validate and quote identifiers, an intentional tightening from
TypeScript's trusted-identifier interpolation. Schema-qualified table names are
not accepted by generated operations; use explicit SQL in query/execute instead.
Vector operations preserve the canonical id/content/metadata/embedding schema,
finite-vector validation, bounded search limits, and guarded delete selectors.

Migration SQL and ledger inserts run in one transaction. Concurrent callers can
race on the ledger read; PostgreSQL rolls back the losing transaction. Migration
names must be unique. DDL requiring autocommit (such as CREATE INDEX CONCURRENTLY)
does not belong in a migration transaction.

Results are JSON values: decimal/UUID values become strings, dates/times ISO
strings, and binary values become Node-compatible Buffer-shaped JSON. Unknown
custom driver objects and non-finite floats fail instead of escaping the task.
These mappings intentionally define Python serialization where raw node-postgres
objects were ambiguous. Live Postgres/pgvector/TLS checks remain in the backlog.

## Installation

```sh
pip install render-lab-tasks-render-postgres==0.1.0
```
