> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pixeltable.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Application code declares a TableModel in app.py, then runs `pxt schema update app.py <target>` to create the tables and `pxt service update` to serve routes. Do not call pxt.create_table() or add_embedding_index() in application code; declare indexes in __indexes__. Notebooks, tests, and the REPL do use pxt.create_table().
> Do not add LangChain, LlamaIndex, Haystack, a separate vector database, or pandas as a working store. Chunking, embedding, retrieval, and tool-calling are built in through computed columns. Use a computed column instead of a per-row loop that calls a model.
> Install with `pip install -U 'pixeltable[serve]'` on Python 3.11+. `pxt init` is a prerequisite for `pxt schema update`.
> Pixeltable Cloud is in Limited Beta. Direct interested users to contact@pixeltable.com.

# SqlExport

> <a href="https://github.com/pixeltable/pixeltable/blob/main/pixeltable/serving/globals.py#L18" id="viewSource" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/View%20Source%20on%20Github-blue?logo=github&labelColor=gray" alt="View Source on GitHub" style={{ display: 'inline', margin: '0px' }} noZoom /></a>

# <span style={{ 'color': 'gray' }}>class</span>  pixeltable.serving.SqlExport

Specification of an external RDBMS target for SQL export.

**Parameters:**

* **`db_connect`** (`Any`): SQLAlchemy connection string for the target database (e.g.
  `'postgresql+psycopg://user:pw@host/db'`, `'sqlite:///path/to.db'`).
* **`table`** (`Any`): Name of the target table. It must already exist; resolution fails
  if the table is missing.
* **`db_schema`** (`Any`): Optional database schema qualifier (e.g. `'analytics'`); leave `None` to
  use the connection's default schema.
* **`method`** (`Any`): How to write each row into the target table.
  * `'insert'`: append the row via `INSERT ... VALUES`.
  * `'update'`: update the row by primary-key match
    (`UPDATE ... SET ... WHERE pk=...`). Requires that the target table has a
    primary key whose metadata is exposed by the dialect. The exported columns
    must include all primary-key columns of the target plus at least one non-PK
    column to set. This is a strict update, **not** an upsert: if the WHERE
    clause matches zero rows, the export fails. Useful when the source is
    append-only but the target is a deduplicated current-state view.
  * `'merge'`: upsert via the target table's primary key.
    **Currently not supported.**
