|
1 |
| -<img src="https://github.com/chdb-io/chdb/raw/main/docs/_static/snake-chdb.png" width=300> |
2 |
| - |
3 |
| -[](https://pypi.org/project/chdb/) |
4 |
| -[](https://pepy.tech/project/chdb) |
5 |
| -[](https://discord.gg/Njw5YXSPPc) |
6 |
| - |
7 |
| -# chDB-CLI |
8 |
| -Simple CLI / REPL for [chdb](https://chdb.io) made in Python |
9 |
| - |
10 |
| -#### Setup |
11 |
| -```bash |
12 |
| -wget https://raw.githubusercontent.com/chdb-io/chdb-cli/main/chdb-cli.py -O chdb-cli |
13 |
| -chmod +x chdb-cli |
14 |
| -``` |
15 |
| -#### Usage |
16 |
| -By default, chDB-cli will create a temporary, self-cleaning database folder for your data.<br> |
17 |
| -To open or create a persistent database, simply include a database folder path as a command line argument. |
18 |
| - |
19 |
| -##### Temporary DB Folder |
20 |
| -``` |
21 |
| -./chdb-cli |
22 |
| -``` |
23 |
| - |
24 |
| -```sql |
25 |
| - |
26 |
| -Connected to auto-clean temporary database. |
27 |
| -CTRL-D to Exit. ESC+ENTER or ; to Run. |
28 |
| -CHDB VERSION: 0.11.5 |
29 |
| - |
30 |
| -:) SELECT 'hello chdb', version() as version; |
31 |
| -┏━━━━━━━━━━━━━━┳━━━━━━━━━━┓ |
32 |
| -┃ 'hello chdb' ┃ version ┃ |
33 |
| -┡━━━━━━━━━━━━━━╇━━━━━━━━━━┩ |
34 |
| -│ hello chdb │ 23.6.1.1 │ |
35 |
| -└──────────────┴──────────┘ |
36 |
| -``` |
37 |
| - |
38 |
| -##### Custom DB Folder |
39 |
| -``` |
40 |
| -./chdb-cli /tmp/chdb |
41 |
| -``` |
42 |
| -```sql |
43 |
| -Connected to local database /tmp/chdb |
44 |
| -CTRL-D to Exit. ESC+ENTER or ; to Run. |
45 |
| -CHDB VERSION: 0.11.5 |
46 |
| - |
47 |
| -:) CREATE DATABASE IF NOT EXISTS db_xxx ENGINE = Atomic; |
48 |
| - |
49 |
| -:) CREATE TABLE IF NOT EXISTS db_xxx.log_table_xxx (x String, y Int) ENGINE = Log; |
50 |
| - |
51 |
| -:) INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5); |
52 |
| - |
53 |
| -:) CREATE VIEW db_xxx.view_xxx AS SELECT * FROM db_xxx.log_table_xxx LIMIT 4; |
54 |
| - |
55 |
| -:) SELECT * FROM db_xxx.view_xxx; |
56 |
| - |
57 |
| -┏━━━┳━━━┓ |
58 |
| -┃ x ┃ y ┃ |
59 |
| -┡━━━╇━━━┩ |
60 |
| -│ a │ 1 │ |
61 |
| -├───┼───┤ |
62 |
| -│ b │ 3 │ |
63 |
| -├───┼───┤ |
64 |
| -│ c │ 2 │ |
65 |
| -├───┼───┤ |
66 |
| -│ d │ 5 │ |
67 |
| -└───┴───┘ |
68 |
| -``` |
69 |
| - |
70 |
| -#### CLI Screenshot |
71 |
| - |
72 |
| - |
| 1 | +### Use [chdb-go-cli](https://github.com/chdb-io/chdb-go) instead |
0 commit comments