Files
qlib/.env.example
T
Simon 6c2f198261 feat(db): SQLite 全量迁移至 MySQL(config.yaml 配置化 + 迁移脚本 + 一致性校验)
- config.yaml database.mysql:host/port/db/user/charset 明文可提交;密码经 password_env
  引用 .env 的 MYSQL_PASSWORD(AGENT.md §33 密钥不进 git)
- config.py _build_mysql_url:URL 优先级 DATABASE_URL env > database.mysql 段 > sqlite 兜底
- pyproject 引入 pymysql>=1.1
- tests/conftest.py 强制每进程 /tmp SQLite(测试绝不触 MySQL 开发库);test_config 覆盖
  mysql 组装/密码可选/sqlite 兜底分支
- scripts/migrate_sqlite_to_mysql.py:sqlite→mysql 一次性迁移工具(keyset 分页 + chunk
  多值 INSERT + 攒批 commit + 幂等续传 + 低配 MySQL 节流 --throttle-sec + --verify-only
  行数与抽样一致性校验);已用于 data/quant.db 约 1605 万行迁移并经校验一致
2026-09-08 23:58:48 +08:00

33 lines
1.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# 复制本文件为项目根目录 .env 并填入真实值。
# .env 已被 .gitignore 忽略 —— 严禁把真实密钥提交进 Git。
# 各变量用途:被根目录 config.yaml 中对应 *_env 字段引用,
# 或由后端 app.core.config 直接读取。
# ============================================================
# ---- Tushare Pro token(首选数据源,Phase 1 数据管线使用)----
TUSHARE_TOKEN=
# ---- 数据库连接 ----
# 默认库由 config.yaml database.mysql 决定(MySQL 192.168.1.10/qlib)。
# 连接优先级:本文件 DATABASE_URL > config.yaml database.mysql > SQLite 兜底。
DATABASE_URL=
# SQLite 示例(显式指定):
# DATABASE_URL=sqlite:///./data/quant.db
# MySQL 示例(手动覆盖 config.yaml 的 mysql 段时):
# DATABASE_URL=mysql+pymysql://user:password@127.0.0.1:3306/qlib
# MySQL 密码(config.yaml database.mysql.password_env 引用;host/port/db/user 在 config.yaml)
MYSQL_PASSWORD=
# ---- AI Agent / LLM(Phase 5)----
# 只需填写 API Key;URL 与模型名已在 config.yaml 的 agent.llm 中配置
# (默认 dashscope 兼容端点 + qwen-plus)。如需覆盖 config.yaml 的值,
# 再取消注释下面两行。
LLM_API_KEY=
# LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
# LLM_MODEL=qwen-plus
# ---- API 应用密钥(必须修改为随机值)----
APP_SECRET_KEY=please-change-me