---
title: "SDK reference: connect and bulk_insert"
description: "The two functions every script in the Custom Actions SDK starts from: connect() to reach a dataset, table, bucket or source"
url: https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/developers-python-sdk-reference
lang: de
lastUpdated: 2026-09-14
---
> For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/de/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/de/llms-full.txt.

# SDK reference: connect and bulk_insert

## Objective

The two functions every script in the [Custom Actions SDK](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/landing-page-developers-python-sdk.md) starts from: `connect()` to reach a dataset, table, bucket or source, and `bulk_insert()` to write a dataframe back.

## The connect function

The `connect()` function is, most of the time, the main entry point to interact with the [Project](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/manage-projects.md).

It takes a **connection string** as parameter and returns a **Connector object**.\
For example:

```python
from forepaas.dwh import connect

connection_string = "dwh/default_dataset/"
connector_default = connect(connection_string)
```

Change the connection string to connect to different sources within the Data Platform environment.\
As a consequence, the object, and available methods, returned by `connect(...)` will be different.

Our [Connectors and Connection Strings article](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/developers-python-sdk-connectors.md) explains each option available in more detail and below you will find the method list for two common connectors:

- [Lakehouse Manager Dataset Connector](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/developers-python-sdk-connect-dataset.md)
- [Data Platform Buckets Connector](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/developers-python-sdk-connect-bucket.md)

## The bulk\_insert function

The `bulk_insert()` function is a very important part of the SDK. You can use it to insert data back into a table. As shown in the code below, it takes a [Dataset Connector](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/developers-python-sdk-connect-dataset.md), a table name and a pandas DataFrame as parameters.

```python
import pandas as pd
from forepaas.dwh import connect
from forepaas.dwh import bulk_insert

# make connection to the default dataset
cn = connect("dwh/default_dataset/")

# extract data from the table with no SQL required
df = cn.select("stations_rides")

# perform your custom transform in the dataframe
df.loc[df["station_name"] == 'Harlem-Lake', "rides"] = 0

# reinsert your dataframe in the destination table
stats = bulk_insert(cn, "stations_rides", df) 
```

### bulk\_insert(connector, table, data, source\_default\_schema=\{}, batch\_size=None)

**Input Parameters**

| Name            |       Type       | Description                                                                                           | Example                                |
| :-------------- | :--------------: | :---------------------------------------------------------------------------------------------------- | :------------------------------------- |
| connector       |     Connector    | Connector instance from the connect() function                                                        | `cn = connect("dwh/default_dataset/")` |
| table           |        str       | name of the destination table where the data is going to be loaded in                                 | -                                      |
| dataframe       | pandas.DataFrame | Dataframe of data to insert, must to have the same column names and types that the target table does. | -                                      |
| default\_schema |       dict       | -                                                                                                     | -                                      |
| batch\_size     |        int       | insertion batch size                                                                                  | -                                      |

**Output**

|         Type        | Description                              | Example |
| :-----------------: | :--------------------------------------- | :------ |
| Tuple(stats, error) | tuple of the statistics of the insertion | -       |

## PySpark Support

Data Platform offers extensive support to handle data with PySpark.
All is done through Spark-compatible methods in the Connector object.\
Check out our [PySpark article](https://docs.ovhcloud.com/de/guides/public-cloud/data-platform/developers-python-sdk-connect-spark.md) for further details.

## Go further

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/de/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated [Discord channel](https://discord.gg/ovhcloud).

If you need support with your OVHcloud services, create a request in our [Help Centre](https://help.ovhcloud.com/csm?id=csm_get_help).

Join our [community of users](https://community.ovhcloud.com/).
