Lakehouse Manager Dataset connector
In order to create a Connector and use it to interact with a Lakehouse Manager table, you can connect to the Default Dataset or to a Custom Dataset
Objective
Using Dataset connector, you may query, insert, update or delete content programmatically.
Connect to the Lakehouse Manager
In order to create a Connector and use it to interact with a Lakehouse Manager table, you can connect to the Default Dataset or to a Custom Dataset.
Below, you will see the connection strings used for each type:
After that you can use the cn_default.list() method to see the tables available in your Lakehouse Manager and then cn_default.select(...) or cn_default.query(...) to get the data from the table you want.
See the next section of this article for additional details.
Note that tables need to be loaded in the Lakehouse Manager before using the Connector.list() method and other Connector object methods. In other words, you have to create a table first in the Lakehouse Manager in order to use a table in the SDK.
Connector methods
list()
Get the list of tables in the dataset.
Output
query(sql, limit=-1, return_type='dataframe')
Execute a SQL query on a compatible source, returns a dataframe (default), an iterable cursor, or a list of dict.
Input Parameters
Output
select(table_name, conds={}, limit=-1, return_type='dataframe' )
Extract data from a table with simple filters, returns a dataframe (default), an iterable cursor, or a list of dict.
Input Parameters
Output
update(table_name, set, conds=None, ignore=False)
Performs an UPDATE SQL query through simple parameters and return the number of affected rows.
Input Parameters
Outputs
delete(table_name, conds)
Performs a deletion based on a specific query with filtering conditions. Returns the number of deleted rows.
If you donβt need any filter, use the truncate method described below.
Input Parameters
Outputs
truncate(table_name)
Truncates (clears) all rows from a table.
Input Parameters
Outputs
insert(table_name, rows, odku=0, returnWarnings=False)
Executes an insert query, adds on duplicate key update (ODKU) operation optionally, and returns statistics about the insertion of the batch.
If you activate the ODKU option, the query will automatically performs updates on existing rows instead of returning errors, regarding the existing primary key values in each row that you are inserting.
Please note that you MUST provide, for each row that you want to insert, at least the primary key of the destination table.
We encourage you to use the module bulk_insert instead of this function, as documented in the Connector methods section of this page, because it has better management of data chunk and insertion.
Input Parameters
Outputs
drop_table(table_name)
drops the table from the query engine
Input Parameters
Outputs
get_table_schema(table_name, catalog_name, schema_name, strict=True)
Return a table schema as a list of forepaas.dwh.attributes.AttributeSchema object
Input Parameters
Output Parameters
Example Output
LogicalObject Methods
In order to use the LogicalObject methods you will need to first import it using:
build(objects)
Launches a logical build in the Lakehouse Manager.
Input Parameters
Outputs
Output Example
create_from_physical(table, dataset='default_dataset', **kwargs)
Creates a logical object based on an existing physical table.
Note: Currently works only with Trino and PostgreSQL catalogs.
Input Parameters
Outputs
get(name)
Retrieves a logical object from the Lakehouse Manager.
Input Parameters
Outputs
list(dataset_name='default_dataset')
Lists all logical objects in the Lakehouse Manager.
Input Parameters
Outputs
remove(name)
Removes a logical object from the Lakehouse Manager.
Input Parameters
Outputs
Output Example
Complementary notes
Due to lacks of metrics collected by PostgreSQL or Snowflake libraries, the statistics returned by Data Platform connectors are calculated based on limited factors.
- When no error happens, inserts and skipped rows are calculated based on total rows before and after inserting, as well as the records (length of data to insert) provided. For example, if we try to insert 3 rows into a table of 5 rows, and the result is 7 rows in total, we consider 2 rows are inserted and 1 row skipped, while records is 3.
- If error happens in a batch of data, the whole batch will be marked as warnings.
- Note for Snowflake: statistics returned by
insert_many()andinsert_dataframe()wont have warnings calculated, all rows fail to insert or skipped will be marked as skipped
Go further
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link 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.
If you need support with your OVHcloud services, create a request in our Help Centre.
Join our community of users.

