Attach a Source

In chDB databases, you can easily query data that’s not stored in database itself. For example CSV files, or other external databases like PostgreSQL or SQLite. To make this more accessible, DB Pilot allows you to “attach” other data sources to chDB instances.

To attach a source, connect to a chDB instance, then click the “Add source” button:

Attach source step 2

The following overlay will show, where you can select the type of source to attach:

Attach source step 3

Files

Local Files

Here, you can attach local files from your computer, like CSV, JSON, Parquet & others.

Attach source - Local file

After attaching the file, it will show up in the sidebar.

Left-click the sidebar entry to explore the file’s data. Or right-click it to start a new SQL query or copy the SQL identifier.

Attach source - Local file example query

For more information, see the description of common options below, and see the documentation of ClickHouse’s file() function.

S3 or S3-compatible

Here, you can attach files from S3 or any S3-compatible object store like Cloudfare R2 or Google Cloud Storage.

Required arguments:

  • Alias: An arbitrary name under which you can later refernce the S3 source.
  • File path: The URL of the file. Must be https:// or http://. Should not be s3://.

Optionally, provide access key ID (user) and secret access key (password) if the resource needs authentication.

For other options, see Common File Options below.

Attach source - S3

After attaching the S3 source, it will show in the sidebar under the provided alias.

Left-click the sidebar entry to explore the source’s data. Or right-click it to start a new SQL query or copy the SQL identifier.

Attach source - S3 example query

Common File Options

Format

The format of your file.

Table structure

A comma-separated list of column name and data type pairs to manually define the table structure.

Example: name String, user_id UInt32

Databases

You can attach PostgreSQL, CockrochDB, and SQLite databases.

Attach source - DB

After setting up a new connection or selecting an existing one, you must provide an alias for the attached connection:

Attach source - DB alias

Once the database is attached, you’ll see it in the sidebar under the given alias - in this example, under dvdrental.

Attach source - DB done

Detach a Source

To detach a source:

  1. Right-click the source you want to remove.
  2. Click the “Detach source” button.
  3. Confirm that you want to detach the source.
Detach source Detach source confirm