Linux command
dolt-sql 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run SQL query
dolt sql -q "[SELECT * FROM table]"
Start interactive
dolt sql
Execute SQL file
dolt sql < [script.sql]
Run query with
dolt sql -q "[SELECT * FROM table]" -r [csv]
Start MySQL-compatible
dolt sql-server
Batch mode
dolt sql -b -q "[INSERT INTO table VALUES (1, 'a')]"
说明
dolt sql provides SQL access to Dolt repositories. It supports MySQL-compatible SQL syntax for querying and modifying data in versioned tables. The interactive shell offers tab completion and command history. Queries can read from any branch or commit using Dolt's SQL extensions, enabling time-travel queries across the repository history. dolt sql-server starts a MySQL-compatible server allowing connections from standard MySQL clients, ORMs, and applications.
参数
- -q _QUERY_
- SQL query to execute.
- -r _FORMAT_
- Result format: tabular, csv, json, null.
- -b, --batch
- Batch mode (no formatting).
- -x, --result-format
- Vertical result format.
- --continue
- Continue on error in batch mode.
- --help
- Display help information.
FAQ
What is the dolt-sql command used for?
dolt sql provides SQL access to Dolt repositories. It supports MySQL-compatible SQL syntax for querying and modifying data in versioned tables. The interactive shell offers tab completion and command history. Queries can read from any branch or commit using Dolt's SQL extensions, enabling time-travel queries across the repository history. dolt sql-server starts a MySQL-compatible server allowing connections from standard MySQL clients, ORMs, and applications.
How do I run a basic dolt-sql example?
Run `dolt sql -q "[SELECT * FROM table]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -q _QUERY_ do in dolt-sql?
SQL query to execute.