# Insert Multiple Rows — Snowflake

> Insert multiple rows into a table

- Key: `snowflake-insert-multiple-rows`
- Type: Action (Write)
- Version: 0.1.7
- App: Snowflake (`snowflake`) — https://pipedream.com/apps/snowflake.md
- This page (HTML): https://pipedream.com/apps/snowflake/actions/insert-multiple-rows
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/snowflake/actions/insert-multiple-rows/insert-multiple-rows.mjs

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `database` | `string` | Yes | The database to use Options are loaded from the connected account. |
| `schema` | `string` | Yes | The schema to use Options are loaded from the connected account. |
| `tableName` | `string` | Yes | The table where you want to add rows Options are loaded from the connected account. |
| `columns` | `string[]` | Yes | Select the columns you want to insert data into Options are loaded from the connected account. |
| `values` | `string` | Yes | Provide an array of arrays. Each nested array should represent a row, with each element of the nested array representing a value (e.g., passing [["Foo",1,2],["Bar",3,4]] will insert two rows of data with three columns each). The most common pattern is to reference an array of arrays exported by a previous step (e.g., {{steps.foo.$return_value}}). You may also enter or construct a string that will JSON.parse() to an array of arrays. |
| `batchSize` | `integer` | No | Number of rows to process per batch. Automatically calculated based on data size if not specified. Recommended: 50-200 for wide tables, 100-500 for narrow tables. |
| `maxPayloadSizeMB` | `integer` | No | Maximum payload size per batch in MB. Helps prevent 413 Payload Too Large errors. |
| `enableBatching` | `boolean` | No | Enable automatic batch processing for large datasets. Disable only for small datasets (< 50 rows) or troubleshooting. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "snowflake",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "snowflake-insert-multiple-rows",
  arguments: {
    database: "Database",
    schema: "Schema",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "snowflake-insert-multiple-rows",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    snowflake: { authProvisionId: "apn_xxxxxxx" },
    database: "Database",
    schema: "Schema",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "snowflake-insert-multiple-rows",
    "configured_props": {
      "snowflake": { "authProvisionId": "apn_xxxxxxx" },
      "database": "Database",
      "schema": "Schema"
    }
  }'
```

---

- App: https://pipedream.com/apps/snowflake.md · All apps: https://pipedream.com/apps
