Skip to main content

Quickstart with your own data

This guide helps you learn how to:

  • Add your own dataset to WrenAI
  • Define relationships between tables

Add your own data

WrenAI can establish connections to your dataset by either linking to a database or reading from files. For more information about connecting to a data source, please refer to Connect Data Sources Overview.

In this tutorial, we will use DuckDB to illustrate how to add datasets from CSV files in the following steps.

1. Prepare your Dataset
Prepare your dataset files. Here we use the e-commerce dataset files for example.
See the DuckDB documentation for more information about our supported file formats.

info

Download our sample data to try out: e-commerce.tar

2. Create a folder in container

docker exec wrenai-wren-engine-1 bash -c "mkdir -p /usr/src/app/etc/data"

3. Copy the archived file into container

docker cp ./e-commerce.tar wrenai-wren-engine-1:/usr/src/app/etc/data/

4. Extracting the archived file

docker exec wrenai-wren-engine-1 bash -c "tar xvf /usr/src/app/etc/data/e-commerce.tar -C /usr/src/app/etc/data"

5. Read files via DuckDB connection
Click on the DuckDB option connect

1. Fill in the connnection properties

  • Display name: Name this connection, here we fill in 'e-commerce'.
  • initial SQL statements: Use SQL statement to read your dataset.
CREATE TABLE reviews AS SELECT * FROM read_csv('./etc/data/e-commerce/reviews.csv', header = true);
CREATE TABLE customers AS SELECT * FROM read_csv('./etc/data/e-commerce/customers.csv', header = true);
CREATE TABLE orders AS SELECT * FROM read_csv('./etc/data/e-commerce/orders.csv', header = true);

Click Next button to start connection. duckdb2

Select tables

Each CSV file will be created as a table, select all tables and click Next. select_table

Define Relationship

Click the +Add button to define relationships between tables in order to make the data model visible. relationship 1. Add the following relationship in customer table:

FromToType
customers.Idorders.CustomerIdOne-to-Many

2. Add the following relationship in orders table:

FromToType
orders.OrderIdreviews.OrderIdOne-to-Many

Click Finish to submit your settings.

Understand your data in Modeling page

model

Ask questions in the Home page

Feel free to ask WrenAI any question. ask