doc: add db connect chapter to README
This commit is contained in:
@@ -81,6 +81,53 @@ npm run dev
|
|||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
|
## 🔌 数据源配置说明
|
||||||
|
|
||||||
|
DataClaw 支持连接多种类型的数据源,以满足不同场景的分析需求。你可以在界面的 **Data Sources** 菜单中点击 **+** 新建并配置它们。以下是常见数据源的详细接入指南:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ PostgreSQL (pgsql)</b></summary>
|
||||||
|
|
||||||
|
连接标准的关系型数据库。你既可以通过表单填充分散的参数,也可以直接粘贴完整的 Connection String。
|
||||||
|
|
||||||
|
- **Host**: 数据库的主机地址。如果你是在本地电脑运行了数据库(如使用 pgAdmin),请填入 `127.0.0.1`(不要填 `localhost`,以避免 Unix Socket 解析错误)。
|
||||||
|
- **Port**: 默认一般为 `5432`。
|
||||||
|
- **Database**: 你要连接的具体数据库名称。
|
||||||
|
- **Username / Password**: 数据库的认证凭据(默认用户通常是 `postgres`)。
|
||||||
|
- **Connection String (可选)**: 也可以直接输入类似 `postgresql://postgres:你的密码@127.0.0.1:5432/你的数据库名` 的字符串,它将覆盖上述单独的输入框配置。
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ Supabase</b></summary>
|
||||||
|
|
||||||
|
专门针对 Supabase 云端 PostgreSQL 数据库优化的连接方式,强制开启 SSL 且默认使用连接池以提高稳定性。
|
||||||
|
|
||||||
|
- 推荐直接使用 **Connection String** 配置:
|
||||||
|
进入你的 Supabase 项目控制台 -> `Project Settings` -> `Database` -> `Connection string` -> 选择 `URI` 选项卡。
|
||||||
|
复制那串类似 `postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres?sslmode=require` 的链接并填入。
|
||||||
|
- *注意*: Supabase 默认开启了 Transaction Pooler(端口 6543)。如果想要直连(Direct connection),请将端口改为 `5432`,并确保 URL 中包含 `sslmode=require`。
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ SQLite</b></summary>
|
||||||
|
|
||||||
|
轻量级的本地文件型数据库,非常适合快速测试或分析单机应用数据。
|
||||||
|
|
||||||
|
- **File Upload**: 你可以直接点击按钮,从本地上传 `.db`、`.sqlite` 或 `.sqlite3` 后缀的数据库文件。文件会被安全地保存在服务端的上传目录中供分析使用。
|
||||||
|
- **File Path (进阶)**: 如果服务部署在服务器上,且 SQLite 文件已存在于服务器的某个绝对路径中,你也可以直接在输入框中填入该文件的绝对路径(如 `/data/my_app.db`)。
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ CSV</b></summary>
|
||||||
|
|
||||||
|
最常见的数据交换格式,即插即用,无需复杂的数据库配置。
|
||||||
|
|
||||||
|
- **File Upload**: 与 SQLite 类似,点击按钮选择本地的 `.csv` 文件上传即可。系统会在后台利用 DuckDB 或 Pandas 等引擎将其虚拟化为一个可供 SQL 查询的表。
|
||||||
|
- 上传成功后,在对话界面中,你可以直接把这个 CSV 文件当作一张数据库表来“提问”!
|
||||||
|
</details>
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
## 🤝 参与贡献
|
## 🤝 参与贡献
|
||||||
|
|
||||||
有个好点子?发现了一个 Bug?非常欢迎你的加入!随时可以提交 Issue 或 Pull Request。让我们一起让数据分析变得更加有趣!
|
有个好点子?发现了一个 Bug?非常欢迎你的加入!随时可以提交 Issue 或 Pull Request。让我们一起让数据分析变得更加有趣!
|
||||||
|
|||||||
@@ -81,6 +81,53 @@ Open your browser and navigate to `http://localhost:5173`. Boom! 🎉 You're rea
|
|||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
|
## 🔌 Data Source Configuration Guide
|
||||||
|
|
||||||
|
DataClaw supports connecting to various types of data sources to meet different analysis needs. You can click **+** in the **Data Sources** menu to create and configure them. Here are detailed connection guides for common data sources:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ PostgreSQL (pgsql)</b></summary>
|
||||||
|
|
||||||
|
Connects to standard relational databases. You can either fill in the individual parameters through the form or paste a complete Connection String directly.
|
||||||
|
|
||||||
|
- **Host**: The host address of the database. If you are running the database on your local machine (e.g., using pgAdmin), please enter `127.0.0.1` (do not enter `localhost` to avoid Unix Socket resolution errors).
|
||||||
|
- **Port**: Typically defaults to `5432`.
|
||||||
|
- **Database**: The specific name of the database you want to connect to.
|
||||||
|
- **Username / Password**: Database authentication credentials (the default user is usually `postgres`).
|
||||||
|
- **Connection String (Optional)**: You can also directly input a string like `postgresql://postgres:your_password@127.0.0.1:5432/your_database_name`, which will override the individual input fields above.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ Supabase</b></summary>
|
||||||
|
|
||||||
|
A connection method specifically optimized for Supabase cloud PostgreSQL databases, enforcing SSL and using connection pools by default to improve stability.
|
||||||
|
|
||||||
|
- We recommend using the **Connection String** configuration directly:
|
||||||
|
Go to your Supabase project console -> `Project Settings` -> `Database` -> `Connection string` -> Select the `URI` tab.
|
||||||
|
Copy the link that looks like `postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres?sslmode=require` and paste it in.
|
||||||
|
- *Note*: Supabase enables Transaction Pooler by default (Port 6543). If you want a Direct connection, change the port to `5432` and ensure the URL includes `sslmode=require`.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ SQLite</b></summary>
|
||||||
|
|
||||||
|
A lightweight local file-based database, perfect for quick testing or analyzing single-machine application data.
|
||||||
|
|
||||||
|
- **File Upload**: You can directly click the button to upload a `.db`, `.sqlite`, or `.sqlite3` database file from your local machine. The file will be securely saved in the server's upload directory for analysis.
|
||||||
|
- **File Path (Advanced)**: If the service is deployed on a server and the SQLite file already exists at an absolute path on the server, you can also enter the absolute path directly in the input box (e.g., `/data/my_app.db`).
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>▶ CSV</b></summary>
|
||||||
|
|
||||||
|
The most common data exchange format, plug-and-play, no complex database configuration required.
|
||||||
|
|
||||||
|
- **File Upload**: Similar to SQLite, click the button to select and upload a local `.csv` file. The system will use engines like DuckDB or Pandas in the background to virtualize it into an SQL-queryable table.
|
||||||
|
- Once uploaded successfully, you can query this CSV file directly as if it were a database table in the chat interface!
|
||||||
|
</details>
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
Got a cool idea? Found a bug? We'd love your help! Feel free to open an issue or submit a pull request. Let's make data analysis fun again!
|
Got a cool idea? Found a bug? We'd love your help! Feel free to open an issue or submit a pull request. Let's make data analysis fun again!
|
||||||
|
|||||||
Reference in New Issue
Block a user