Skip to main content
ClaudeChatGPT

DuckDB (files)

Use this guide to connect local files through DuckDB so you can query CSV, JSON, and Parquet data in Wren AI.

We support file connections via DuckDB. To add a connection, click on the DuckDB option in the Connect a data source section. connect

info
Supported File Formats:
  • CSV Files
  • JSON Files
  • Parquet Files
Supported Data Types:
  • BIGINT
  • BIT
  • BLOB
  • BOOLEAN
  • DATE
  • DECIMAL
  • DOUBLE
  • INTEGER
  • REAL
  • SMALLINT
  • TIMESTAMP
  • VARCHAR
  • ARRAY
    • BOOLEAN
    • INTEGER
    • DOUBLE
    • DECIMAL
    • VARCHAR
    • TIMESTAMP
    • DATE

Connect

Fill in the connection settings: duckdb

Display name

The display name for the database in the Wren AI interface.

Initial SQL Statements

The first step of connecting files is to load your data into DuckDB. DuckDB provides several data ingestion statements that allow you to fill up the database. Please refer to the DuckDB documentation for methods of loading data from different file types.

Here are some examples:

CREATE TABLE new_tbl AS SELECT * FROM read_csv('input.csv', header = true);
info

You can read files from either a local path or a cloud storage URL (such as AWS S3).

Configuration options

DuckDB has a number of configuration options that can be used to change the behavior of the system. You can set configurations in this section if needed, or leave it blank to use the default configurations. When filling in configurations, set each configuration name and value as a pair. Please refer to the DuckDB documentation for details of the configuration options.

Extensions

DuckDB has a flexible extension mechanism that allows for dynamically loading extensions. Built-In extensions and autoloadable extensions will be automatically loaded. You can add other extensions by filling in the extension names if needed. Please refer to the DuckDB documentation for the list of official extensions.

Click Next to start the connection and go to the next step.

Select Tables

All tables of your connected files will be listed in this step. Select which tables you want to use in Wren AI. Each selected table will be created as a data model. See the Modeling documentation to learn more about data models. select_table

Define relationships

Define the relationships among selected tables in this step. You can add relationships by clicking the Add relationships button on the table blocks. relationship

Define the following properties in a relationship:

  • From: Select the left side table and column of this relationship.
  • To: Select the right side table and column of this relationship.
  • Relationship Type: Select the type of relationship. add_relationship

Find more information about relationships in Modeling - Working with Relationships.

You can also skip this step and finish the connection.