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:
The following overlay will show, where you can select the type of source to attach:
Files
Local Files
Here, you can attach local files from your computer, like CSV, JSON, Parquet & others.
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.
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://
orhttp://
. Should not bes3://
.
Optionally, provide access key ID (user) and secret access key (password) if the resource needs authentication.
For other options, see Common File Options below.
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.
Common File Options
Format
The format of your file.
- Use
Auto
for automatic detection based on file extension. - See all available formats in ClickHouse’s documentation
- Some common formats:
CSV
: CSV without headerCSVWithNames
: CSV with headerTabSeparated
: TSV without headerTabSeparatedWithNames
: TSV with headerJSONEachRow
: Newline-delimited JSON
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.
After setting up a new connection or selecting an existing one, you must provide an alias for the attached connection:
Once the database is attached, you’ll see it in the sidebar under the given alias - in this example, under dvdrental
.
Detach a Source
To detach a source:
- Right-click the source you want to remove.
- Click the “Detach source” button.
- Confirm that you want to detach the source.