Skip to content

Commit

Permalink
docs: revise tgdump --sql spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru committed Jan 5, 2025
1 parent 9a6a219 commit f75aed5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Available Tools

* [tgsql](./modules/tgsql) - Text based SQL client program.
* [tgdump](./modules/tgdump) - Table Dump Tool.
* [tgdump](./modules/tgdump) - Dump Tool.

## Requirements

Expand Down
16 changes: 11 additions & 5 deletions docs/tgdump-design_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@

```sh
tgdump <table-name> [<table-name> [...]] --to </path/to/destination-dir> --connection <endpoint-uri>
tgdump --sql <query-label>:<query-text> [<query-label>:<query-text> [...]] --to </path/to/destination-dir> --connection <endpoint-uri>
tgdump --sql [<query-label>:]<query-text> [[<query-label>:]<query-text> [...]] --to </path/to/destination-dir> --connection <endpoint-uri>
```
* mandatory parameters
* `<table-name>` (`--sql` が指定されていない場合)
* ダンプ対象のテーブル名 (複数指定可能)
* `<query-label>` (`--sql` が指定された場合)
* 直後の `<query-text>` を識別するためのクエリラベル
* クエリラベルに文字 `:` や空白文字を含めることはできず、1文字以上40文字以内である必要がある
* `<query-text>` (`--sql` が指定された場合)
* ダンプ処理の内容を表す SQL 文字列
* `--to`
Expand All @@ -53,6 +50,13 @@ tgdump --sql <query-label>:<query-text> [<query-label>:<query-text> [...]] --to
* optional parameters
* `--sql`
* テーブル名を指定する代わりに、ダンプ処理の内容を表す SQL 文を直接指定する
* `<query-label>` (`--sql` が指定された場合)
* 直後の `<query-text>` を識別するためのクエリラベル
* クエリラベルに以下のいずれの文字も含めることはできない
* 空白文字 (タブや改行を含む)
* クウォート文字 (`'`, `"`)
* コロン (`:`)
* 未指定の場合は、 "`<sql><引数の位置>`" という名前のラベルを自動的に付与する (引数の位置は 1 から始まる整数)
* `--profile`
* [ダンププロファイル](#ダンププロファイル)名
* 未指定の場合は `default` という名前のプロファイルを使用する
Expand Down Expand Up @@ -161,7 +165,9 @@ tgdump --sql <query-label>:<query-text> [<query-label>:<query-text> [...]] --to
------|------|------
`kind` | `data` |
`format` | `dump-info` | ダンプ対象のテーブルをデータベース上に検出したことを表す
`table` | 対象のテーブル名 | `--sql` が指定された場合はクエリラベルを出力
`type` | ダンプの種類 | `--sql` の指定がない場合は `table`, ある場合は `query`
`table` | テーブル名 | `--sql` が未指定の場合はクエリラベル
`query` | クエリ文字列 | `--sql` が未指定の場合は absent
`destination` | 出力先ファイルパス |
`columns` | ダンプ対象列の一覧 | 形式は後述 | `--sql` が指定された場合は absent
Expand Down
12 changes: 7 additions & 5 deletions modules/tgdump/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `tgdump` - Tsurugi Table Dump Tool
# `tgdump` - Tsurugi Dump Tool

Tsurugi Table Dump Tool extracts the contents of table data and saves them on files.
Tsurugi Dump Tool extracts the contents of table data or query result and saves them on files.

## Build and Install

Expand Down Expand Up @@ -32,13 +32,12 @@ Deploy the files mentioned above, and the tgdump command will be available for u

```sh
tgdump <table-name> [<table-name> [...]] --to </path/to/destination-dir> --connection <endpoint-uri> ...
tgdump --sql <query-label>:<query-text> [<query-label>:<query-string> [...]] --to </path/to/destination-dir> --connection <endpoint-uri> ...
tgdump --sql [<query-label>:]<query-text> [[<query-label>:]<query-string> [...]] --to </path/to/destination-dir> --connection <endpoint-uri> ...
```
parameters:
* `<table-name>` - the dump target table names
* `<query-label>` - the label for the accompanying SQL text
* `<query-text>` - the SQL text for dump operations
* `--to` - the destination directory
* `--connection` - the target Tsurugi endpoint URI (must be `ipc:` protocol)
Expand All @@ -48,6 +47,9 @@ optional parameters:
* `--sql`
* use SQL text for dump operations instead of table names
* default: use table names
* `<query-label>`
* the label for the accompanying SQL text (`<query-text>`)
* default: auto-generated label
* `--profile`
* dump profile name / file path
* available profile name:
Expand All @@ -71,7 +73,7 @@ optional parameters:
* default: no transaction labels
* `--threads`
* the number of client threads in dump operations
* The number of simultaneous processing tables is limited to the number of this threads.
* The number of simultaneous processing tables/queries is limited to the number of this threads.
* default: `1`
* `-v,--verbose`
* print verbose messages during executions.
Expand Down

0 comments on commit f75aed5

Please sign in to comment.