--- title: "Distributed Write" sidebarTitle: "Distributed Write" description: "How LanceDB Enterprise distributes CTAS imports and how SDK callers coordinate staged ingestion." icon: upload availability: embedded: unavailable enterprise: available --- ## Server-coordinated CTAS imports {#ctas} For `CREATE TABLE ... AS SELECT`, the query node partitions the source across executors. The source can be Parquet files from a HuggingFace dataset or row-group ranges of an existing Lance dataset in object storage. Each executor writes uncommitted Lance data files and reports back. The query node collects those results and commits them together as the new table's first version. See [Architecture](/index#architecture).
```mermaid %%{init: {"theme": "base", "themeVariables": { "background": "#171513", "primaryColor": "#1e1b19", "primaryTextColor": "#f4ebe8", "primaryBorderColor": "#4c443f", "lineColor": "#847770", "textColor": "#f4ebe8", "edgeLabelBackground": "#171513", "fontFamily": "Inter, sans-serif", "fontSize": "18px" }}}%% flowchart LR S["Source
HuggingFace Parquet, or an
existing Lance dataset in
S3 / GCS / Azure"] Q["Query node
plans the CTAS,
commits the result"] PE1["Plan executor
writes uncommitted files"] PE2["Plan executor
writes uncommitted files"] PE3["Plan executor
writes uncommitted files"] S --> Q Q --> PE1 Q --> PE2 Q --> PE3 PE1 --> Q PE2 --> Q PE3 --> Q classDef default fill:#1e1b19,stroke:#4c443f,stroke-width:1px,color:#f4ebe8 classDef accent fill:#2a1810,stroke:#e8582d,stroke-width:1.5px,color:#f4ebe8 class Q accent ```
```mermaid %%{init: {"theme": "base", "themeVariables": { "background": "#ffffff", "primaryColor": "#ffffff", "primaryTextColor": "#221d19", "primaryBorderColor": "#ad9e95", "lineColor": "#6b625c", "textColor": "#221d19", "edgeLabelBackground": "#ffffff", "fontFamily": "Inter, sans-serif", "fontSize": "18px" }}}%% flowchart LR S["Source
HuggingFace Parquet, or an
existing Lance dataset in
S3 / GCS / Azure"] Q["Query node
plans the CTAS,
commits the result"] PE1["Plan executor
writes uncommitted files"] PE2["Plan executor
writes uncommitted files"] PE3["Plan executor
writes uncommitted files"] S --> Q Q --> PE1 Q --> PE2 Q --> PE3 PE1 --> Q PE2 --> Q PE3 --> Q classDef default fill:#ffffff,stroke:#ad9e95,stroke-width:1px,color:#221d19 classDef accent fill:#fff1ec,stroke:#e8582d,stroke-width:1.5px,color:#221d19 class Q accent ```
Ordinary `INSERT` and `merge_insert` run on the node or process that executes them. The CTAS import is the server-coordinated path that assigns writes to multiple executors. ## SDK-coordinated staged writes {#sdk-staged-writes} For an existing table, an application can divide its input among workers and share one staged write ID. Each worker opens the same table and branch and stages its batch through the SDK. The application's coordinator calls `commit()` to publish one version or `abort()` to discard the upload. Enterprise uses its multipart write endpoints for staging and completion. For a staged overwrite, the SDK rejects non-empty input with top-level schema metadata before uploading any parts. Field and nested field metadata are supported. See the [staged write examples](/ingestion/insert#staged-writes). ## Write interfaces {#write-interfaces} - [Import Datasets](/ingestion/import) for distributed CTAS imports. - [Insert data](/ingestion/insert) for ordinary `add()` and explicit staged writes, and [Merge](/ingestion/merge-insert) for upserts. - [Storage Integration](/sql/ddl/storage-integration) for configuring the source a CTAS import reads from.