@@ -54,6 +54,8 @@ $ trdsql [options] SQL
54
54
55
55
* ` -a ` ** filename**
56
56
Analyze file and suggest SQL.
57
+ * ` -A ` ** filename**
58
+ Analyze but only suggest SQL.
57
59
* ` -config ` ** filename**
58
60
Configuration file location.
59
61
* ` -db ` ** db name**
@@ -613,31 +615,29 @@ $ trdsql -a testdata/test.ltsv
613
615
```
614
616
615
617
``` console
616
- The table name is testdata/test.ltsv .
617
- The file type is LTSV .
618
+ The table name is testdata/header.csv .
619
+ The file type is CSV .
618
620
619
621
Data types:
620
622
+-------------+------+
621
623
| column name | type |
622
624
+-------------+------+
623
625
| id | text |
624
- | name | text |
625
- | price | text |
626
+ | \`name\` | text |
626
627
+-------------+------+
627
628
628
629
Data samples:
629
- +----+--------+-------+
630
- | id | name | price |
631
- +----+--------+-------+
632
- | 1 | Orange | 50 |
633
- | 2 | Melon | 500 |
634
- +----+--------+-------+
630
+ +----+----------+
631
+ | id | \`name\` |
632
+ +----+----------+
633
+ | 1 | Orange |
634
+ +----+----------+
635
635
636
636
Examples:
637
- trdsql "SELECT id, name, price FROM testdata/test.ltsv "
638
- trdsql "SELECT id, name, price FROM testdata/test.ltsv WHERE id = '2 '"
639
- trdsql "SELECT id,count(id) FROM testdata/test.ltsv GROUP BY id"
640
- trdsql "SELECT id, name, price FROM testdata/test.ltsv ORDER BY id LIMIT 10"
637
+ trdsql -db sdb -ih "SELECT id, \` name\` FROM testdata/header.csv "
638
+ trdsql -db sdb -ih "SELECT id, \` name\` FROM testdata/header.csv WHERE id = '1 '"
639
+ trdsql -db sdb -ih "SELECT id, count(id) FROM testdata/header.csv GROUP BY id"
640
+ trdsql -db sdb -ih "SELECT id, \` name\` FROM testdata/header.csv ORDER BY id LIMIT 10"
641
641
```
642
642
643
643
Other options(-id,-ih,-ir,-is,icsv,iltsv,-ijson,-itbln...) are available.
@@ -646,6 +646,19 @@ Other options(-id,-ih,-ir,-is,icsv,iltsv,-ijson,-itbln...) are available.
646
646
$ trdsql -ih -a testdata/header.csv
647
647
```
648
648
649
+ Similarly, with *** -A filename*** option, only Examples (SQL) is output.
650
+
651
+ ``` console
652
+ $ trdsql -ih -A testdata/header.csv
653
+ ```
654
+
655
+ ``` console
656
+ trdsql -ih "SELECT id, \`name\` FROM testdata/header.csv"
657
+ trdsql -ih "SELECT id, \`name\` FROM testdata/header.csv WHERE id = '1'"
658
+ trdsql -ih "SELECT id, count(id) FROM testdata/header.csv GROUP BY id"
659
+ trdsql -ih "SELECT id, \`name\` FROM testdata/header.csv ORDER BY id LIMIT 10"
660
+ ```
661
+
649
662
### configuration
650
663
651
664
You can specify driver and dsn in the configuration file.
0 commit comments