Skip to content

Commit

Permalink
Add ClickHouse sample
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Jul 24, 2024
1 parent 1180eee commit 5a05226
Show file tree
Hide file tree
Showing 21 changed files with 695 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ doc: build doc_sqlite
$(TBLS) doc ms://SA:MSSQLServer-Passw0rd@localhost:11433/testdb -c testdata/test_tbls_mssql.yml -f sample/mssql
$(TBLS) doc mongodb://mongoadmin:secret@localhost:27017/test?authSource=admin -f sample/mongo
env AWS_ENDPOINT_URL=http://localhost:18000 $(TBLS) doc dynamodb://ap-northeast-1 -c testdata/test_tbls_dynamodb.yml -f sample/dynamodb
$(TBLS) doc clickhouse://default@localhost:9000/testdb -f sample/clickhouse
$(TBLS) doc pg://postgres:pgpass@localhost:55413/testdb?sslmode=disable -c testdata/test_tbls_postgres.yml -j -f sample/adjust
$(TBLS) doc my://root:mypass@localhost:33308/testdb -c testdata/test_tbls.yml -t png -f sample/png
$(TBLS) doc my://root:mypass@localhost:33308/testdb -c testdata/test_tbls.yml -t mermaid -f sample/mermaid
Expand All @@ -84,6 +85,7 @@ testdoc: build testdoc_sqlite
$(TBLS) diff ms://SA:MSSQLServer-Passw0rd@localhost:11433/testdb -c testdata/test_tbls_mssql.yml sample/mssql
$(TBLS) diff mongodb://mongoadmin:secret@localhost:27017/test?authSource=admin sample/mongo
env AWS_ENDPOINT_URL=http://localhost:18000 $(TBLS) diff dynamodb://ap-northeast-1 -c testdata/test_tbls_dynamodb.yml sample/dynamodb
$(TBLS) diff clickhouse://default@localhost:9000/testdb sample/clickhouse
$(TBLS) diff pg://postgres:pgpass@localhost:55413/testdb?sslmode=disable -c testdata/test_tbls_postgres.yml -j sample/adjust
$(TBLS) diff my://root:mypass@localhost:33308/testdb -c testdata/test_tbls.yml -t png sample/png
$(TBLS) diff my://root:mypass@localhost:33308/testdb -c testdata/exclude_test_tbls.yml sample/exclude
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: '3.4'

services:
postgres95:
image: postgres:9.5
platform: linux/amd64
restart: always
ports:
- "55432:5432"
Expand All @@ -21,6 +20,7 @@ services:
- POSTGRES_DB=testdb
mysql56:
image: mysql:5.6
platform: linux/amd64
restart: always
ports:
- "33306:3306"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67

## Description

<details>
<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE testdb.`.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67` (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory
```

</details>

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| name1 | UInt64 | | false | | | |
| name2 | Nullable(String) | | false | | | |

## Relations

![er](.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions sample/clickhouse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# testdb

## Tables

| Name | Columns | Comment | Type |
| ---- | ------- | ------- | ---- |
| [.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67](.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md) | 2 | | Memory |
| [id_value_dictionary](id_value_dictionary.md) | 2 | | Dictionary |
| [materialized_view](materialized_view.md) | 2 | | MaterializedView |
| [numbers_table](numbers_table.md) | 1 | | SystemNumbers |
| [source_table](source_table.md) | 2 | | MergeTree |
| [t1](t1.md) | 1 | | Memory |
| [table_name](table_name.md) | 8 | comment for table | MergeTree |
| [view](view.md) | 5 | | View |

## Stored procedures and functions

| Name | ReturnType | Arguments | Type |
| ---- | ------- | ------- | ---- |
| linear_equation | | | |

## Relations

![er](schema.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
27 changes: 27 additions & 0 deletions sample/clickhouse/id_value_dictionary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# id_value_dictionary

## Description

<details>
<summary><strong>Table Definition</strong></summary>

```sql
CREATE DICTIONARY testdb.id_value_dictionary (`id` UInt64, `value` String) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'source_table')) LIFETIME(MIN 0 MAX 1000) LAYOUT(FLAT())
```

</details>

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | UInt64 | | false | | | |
| value | String | | false | | | |

## Relations

![er](id_value_dictionary.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
29 changes: 29 additions & 0 deletions sample/clickhouse/id_value_dictionary.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions sample/clickhouse/materialized_view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# materialized_view

## Description

<details>
<summary><strong>Table Definition</strong></summary>

```sql
CREATE MATERIALIZED VIEW testdb.materialized_view (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory AS SELECT name1, name2 FROM testdb.table_name ORDER BY name1 DESC
```

</details>

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| name1 | UInt64 | | false | | | |
| name2 | Nullable(String) | | false | | | |

## Referenced Tables

| Name | Columns | Comment | Type |
| ---- | ------- | ------- | ---- |
| [table_name](table_name.md) | 8 | comment for table | MergeTree |

## Relations

![er](materialized_view.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
29 changes: 29 additions & 0 deletions sample/clickhouse/materialized_view.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions sample/clickhouse/numbers_table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# numbers_table

## Description

<details>
<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE testdb.numbers_table (`number` UInt64) AS numbers(100)
```

</details>

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| number | UInt64 | | false | | | |

## Relations

![er](numbers_table.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
26 changes: 26 additions & 0 deletions sample/clickhouse/numbers_table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5a05226

Please sign in to comment.