Connect your database

Your reports read your data through a connector. There are three kinds: data files you drop in a folder, a database file on your computer, and a hosted database. A data-file connector needs no setup; the others need a few values in the app's private settings file, app/.env. That file stays on your computer and is never saved to git.

Start

Tell Claude where your data is:

"My sales are in a CSV export. Set the app up to read it."

"Connect my Postgres database. Open app/.env for me and I will paste the connection string in myself."

You can also give Claude the values in the chat, but you do not have to: pasting secrets into the file yourself keeps them out of the conversation.

Claude creates app/.env from app/.env.example if it does not exist yet, shows you which lines to fill in, and checks the result. A key with a default may be left out.

Data files

The data-file connectors read the files in a folder of app/data/ as tables you query in SQL (SQLite's dialect). Each file is a table named after it: sales.csv is sales. Names and column headers are made lowercase, with anything but letters, digits and _ turned into _: the header Order Date is the column order_date. A column holding only numbers is numbers; everything else is text. When you add, change or remove a file, the next report you open reads it again. Each connector ships a small sample file, sales, with four regions and their sales and orders.

CSV files (csv)

Drop .csv files in app/data/csv/. The first line is the header; commas, semicolons and tabs all work. This is the default connector: it needs no .env at all.

"Here is orders.csv. Put it in the CSV folder and make a report of orders per month."

KeyWhat it isDefault
CSV_DIRThe folder, from app/data/csv

Excel files (excel)

Drop .xlsx files in app/data/excel/. Every sheet is a table named <file>_<sheet>: the sheet Regions of sales.xlsx is sales_regions. A sheet's first row is its header; a formula reads as its last value.

"I put budget.xlsx in the Excel folder. Which tables did it make?"

KeyWhat it isDefault
EXCEL_DIRThe folder, from app/data/excel

JSON files (json)

Drop .json files in app/data/json/. A file is a list of objects, or an object with that list under "rows". The columns are every key any object has; a missing key is empty.

"Read the export in app/data/json/visits.json and chart visits per day."

KeyWhat it isDefault
JSON_DIRThe folder, from app/data/json

Local database

SQLite (sqlite)

A SQLite database file on your computer, opened read-only.

"Read my SQLite database at app/data/shop.sqlite."

KeyWhat it isDefault
SQLITE_PATHThe database file, from app/data/app.sqlite

Hosted database

SQL Server (sqlserver)

"Connect our SQL Server. I will paste the password into app/.env myself."

KeyWhat it isDefault
SQLSERVER_HOSTThe server's address
SQLSERVER_PORTThe port1433
SQLSERVER_DBThe database name
SQLSERVER_USERYour database user
SQLSERVER_PASSWORDIts password
SQLSERVER_ENCRYPTWhether the connection is encryptedtrue

Postgres (postgres)

"Connect my Postgres database."

KeyWhat it is
POSTGRES_URLThe connection string, postgres://user:password@host:5432/database

MySQL (mysql)

"Connect our MySQL database. I have the connection string."

KeyWhat it is
MYSQL_URLThe connection string, mysql://user:password@host:3306/database

BigQuery (bigquery)

BigQuery signs in with a service account key file. Ask whoever runs your Google Cloud project for one with read access to BigQuery, save it on your computer, and give Claude its path.

"Connect BigQuery, project my-project. The key file is in my Downloads."

KeyWhat it isDefault
BIGQUERY_PROJECTThe Google Cloud project the queries run (and are billed) in
GOOGLE_APPLICATION_CREDENTIALSThe path to the service account key file
BIGQUERY_LOCATIONWhere the datasets are, such as EU or USnone

Amazon Redshift (redshift)

"Connect our Redshift cluster."

KeyWhat it isDefault
REDSHIFT_HOSTThe cluster's endpoint, without the port
REDSHIFT_PORTThe port5439
REDSHIFT_DBThe database name
REDSHIFT_USERYour database user
REDSHIFT_PASSWORDIts password

The connection is encrypted and the server's certificate is checked.

More than one database

When the app has more than one connector, SILVI_CONNECTOR in app/.env names the default one, and each report can name its own in its file (connector: "redshift" in its meta). Ask:

"Make Redshift the default, and have the Orders report read Postgres."

A database the app does not have yet

If your app was made without the connector you need, ask:

"Add the SQL Server connector."

Claude adds it to the app and adds its keys to app/.env.example. Then fill them in as above.

Check it works

  1. Open a report that uses the database. It no longer says Not connected.
  2. Ask Claude: "Open every report and check its figures load." A query the database refuses shows its message on the page.

If a report still says Not connected, it names the keys it is missing. Read Fix problems.