Skip to content

Commit 2384bed

Browse files
committed
merge main into branch and fix merge conflicts
2 parents 5a202c9 + 6cd1d50 commit 2384bed

File tree

1,376 files changed

+8661
-81059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,376 files changed

+8661
-81059
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ docs/cloud/manage/api/keys-api-reference.md
4545
docs/cloud/manage/api/members-api-reference.md
4646
docs/cloud/manage/api/organizations-api-reference.md
4747
docs/cloud/manage/api/services-api-reference.md
48+
docs/cloud/manage/api/privateEndpointConfig-api-reference.md
49+
docs/cloud/manage/api/prometheus-api-reference.md
50+
docs/cloud/manage/api/usageCost-api-reference.md
51+
docs/whats-new/changelog/index.md
4852
.vscode
4953
.aspell.en.prepl
5054
*.md.bak

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,16 @@ You can run a copy of this website locally within a few steps. Some folks find t
6969
# ✨ Done in 6.44s.
7070
```
7171

72-
1. Use Yarn to grab the latest documentation changes from the `ClickHouse/ClickHouse` repository:
72+
1. Use Yarn to grab the latest documentation changes from the `ClickHouse/ClickHouse` repository and build the documentation using `yarn-build`:
7373

7474
```shell
75-
yarn copy-clickhouse-repo-docs
75+
yarn build
7676
7777
# Cloning into 'ClickHouse'...
7878
# ...
79-
# Copying docs from ClickHouse ...
80-
# Successfully executed copy from master
81-
# ✨ Done in 18.56s.
82-
```
83-
84-
Alternatively, you can use a local copy of `ClickHouse/ClickHouse` if you already have that repository cloned locally with `-l`.
85-
86-
```shell
87-
yarn copy-clickhouse-repo-docs -l "/Users/johnny/clickhouse/"
79+
# [SUCCESS] Generated static files in "build".
80+
# [INFO] Use `npm run serve` command to test your build locally.
81+
# ✨ Done in 105.96s.
8882
```
8983

9084
1. Start the local web-server:
@@ -104,6 +98,18 @@ You can run a copy of this website locally within a few steps. Some folks find t
10498

10599
If you want to build a static copy of this repository that doesn't require a constant server running to view, you can use `yarn build` instead of `yarn start`. The `yarn build` will output a static copy of the website in the `/build` directory. This process takes around 10 minutes to complete on an M1 Macbook with 8GB RAM.
106100
101+
1. Should you wish to make changes to documents which are located in the ClickHouse/ClickHouse repo and want to visualize what the changes made look like locally you can use `yarn copy-clickhouse-repo-docs -l` and provide a path to the ClickHouse repository on your local machine, for example:
102+
103+
```
104+
# yarn copy-clickhouse-repo-docs -l /Users/user/Desktop/ClickHouse
105+
# Successfully executed local copy
106+
# ✨ Done in 1.15s.
107+
```
108+
109+
We recommend to install rsync in order to only copy what is needed, however the script will fallback to using `cp` if rsync is not available.
110+
111+
Running `yarn copy-clickhouse-repo-docs` without any arguments will pull in the latest docs changes from github.
112+
107113
### Notes {#notes}
108114
109115
Here are some things to keep in mind when building a local copy of the ClickHouse docs site.
@@ -126,6 +132,10 @@ Please assign any pull request (PR) against an issue; this helps the docs team t
126132
127133
Check out the GitHub docs for a refresher on [how to create a pull request](https://docs.github.com/en/desktop/working-with-your-remote-repository-on-github-or-github-enterprise/creating-an-issue-or-pull-request-from-github-desktop).
128134
135+
### Style guidelines
136+
137+
For style guidelines, see ["Style guide"](/contribute/style-guide.md).
138+
129139
### Tests and CI/CD {#tests-and-cicd}
130140
131141
There are five workflows that run against PRs in this repo:

clickhouseapi.js

Lines changed: 55 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function generateDocusaurusMarkdown(spec, groupedEndpoints, prefix) {
8787
if (operation.responses && operation.responses['200'].content["application/json"]) {
8888
const rawSchema = operation.responses['200'].content["application/json"].schema
8989
const result = rawSchema.properties.result
90-
90+
9191
if (result) {
9292
markdownContent += `\n### Response\n\n`;
9393

@@ -96,54 +96,77 @@ function generateDocusaurusMarkdown(spec, groupedEndpoints, prefix) {
9696
const schema = rawSchema.properties.result.type === 'array' ?
9797
result.items['$ref'].split('/').pop() : result['$ref'].split('/').pop()
9898

99-
const bodyParamAttrs = spec.components.schemas[schema].properties
100-
const bodyParams = Object.keys(bodyParamAttrs)
101-
const sampleResponseObj = {}
102-
99+
const extractedFields = extractFields(result, spec.components.schemas, undefined);
103100
markdownContent += `| Name | Type | Description |\n`
104101
markdownContent += `| :--- | :--- | :---------- |\n`
102+
markdownContent += extractedFields.markdown
103+
markdownContent += '\n'
104+
markdownContent += `\n#### Sample response\n\n`;
105+
markdownContent += '```\n'
106+
markdownContent += `${JSON.stringify(extractedFields.json, 0, 2)}`
107+
markdownContent += '\n```\n'
108+
}
109+
}
110+
}
111+
}
112+
113+
return markdownContent;
114+
}
115+
116+
function extractFields(result, schemas, fieldPrefix) {
117+
const schemaRef = result.type === 'array' ? result.items['$ref'].split('/').pop() : result['$ref'].split('/').pop();
118+
const bodyParamAttrs = schemas[schemaRef].properties;
119+
const bodyParams = Object.keys(bodyParamAttrs);
120+
const resObj = {
121+
markdown: '',
122+
json: {}
123+
}
124+
for (const parameter of bodyParams) {
125+
const newPrefix = fieldPrefix ? `${fieldPrefix}.${parameter}` : parameter;
126+
if (bodyParamAttrs[parameter]['$ref']) {
127+
128+
const nestedObj = extractFields(bodyParamAttrs[parameter], schemas, newPrefix)
129+
resObj.markdown += nestedObj.markdown
130+
resObj.json[parameter] = nestedObj.json
131+
}
132+
else {
133+
const paramType = bodyParamAttrs[parameter].format || bodyParamAttrs[parameter].type;
134+
resObj.markdown += `| ${newPrefix} | ${paramType || ''} | ${bodyParamAttrs[parameter].description || ''} | \n`;
135+
resObj.json[parameter] = returnParamTypeSample(bodyParamAttrs[parameter].format || bodyParamAttrs[parameter].type);
136+
}
137+
}
138+
return resObj;
139+
}
105140

106-
for (const parameter of bodyParams) {
107-
const paramType = bodyParamAttrs[parameter].format || bodyParamAttrs[parameter].type
108-
markdownContent += `| ${parameter} | ${paramType || ''} | ${bodyParamAttrs[parameter].description || ''} | \n`
109-
110-
switch (paramType) {
111-
case 'uuid':
112-
sampleResponseObj[parameter] = 'uuid';
141+
function returnParamTypeSample(paramType) {
142+
let result;
143+
switch(paramType) {
144+
case 'uuid':
145+
result = 'uuid';
113146
break;
114147
case 'string':
115-
sampleResponseObj[parameter] = 'string';
148+
result = 'string';
116149
break;
117150
case 'number':
118-
sampleResponseObj[parameter] = 0;
151+
result = 0;
119152
break;
120153
case 'array':
121-
sampleResponseObj[parameter] = 'Array';
154+
result = 'Array';
122155
break;
123156
case 'boolean':
124-
sampleResponseObj[parameter] = 'boolean';
157+
result = 'boolean';
125158
break;
126159
case 'date-time':
127-
sampleResponseObj[parameter] = 'date-time';
160+
result = 'date-time';
161+
break;
162+
case 'date':
163+
result = 'date';
128164
break;
129165
case 'email':
130-
sampleResponseObj[parameter] = 'email';
166+
result = 'email';
131167
break;
132-
}
133-
}
134-
135-
markdownContent += `\n#### Sample response\n\n`;
136-
markdownContent += '```\n'
137-
markdownContent += `${JSON.stringify(sampleResponseObj, 0, 2)}`
138-
markdownContent += '\n```\n'
139-
}
140-
141-
142-
}
143-
}
144168
}
145-
146-
return markdownContent;
169+
return result;
147170
}
148171

149172
async function main() {

contribute/style-guide.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# ClickHouse docs style guide
2+
3+
In this document, you will find a number of style guidelines for writing documentation.
4+
The rules in this guide are intended to assist in helping us to create a high
5+
quality documentation offering on par with the quality of ClickHouse itself.
6+
7+
## YAML front matter
8+
9+
Begin every new markdown document with YAML front-matter:
10+
11+
```markdown
12+
---
13+
title: Using a clickhouse-local database
14+
sidebar_label: Using clickhouse-local database
15+
slug: /chdb/guides/clickhouse-local
16+
description: Learn how to use a clickhouse-local database with chDB
17+
keywords: [chdb, clickhouse-local]
18+
---
19+
```
20+
21+
## Explicit header tags
22+
23+
Due to the way our translation system works, it is necessary to add an explicit
24+
anchor tag next to every header, such as `{#explicit-anchor-tag}`.
25+
26+
For example:
27+
28+
```markdown
29+
## My header {#my-header}
30+
```
31+
32+
### Associated markdown rule or CI check
33+
- [`custom-anchor-headings`](/scripts/.markdownlint-cli2.yaml)
34+
35+
## Images
36+
37+
In all cases images get added to the `static/images` directory of the repository.
38+
Under the images directory you should place the images according to the folder
39+
structure of the docs.
40+
41+
For example, if you wanted to add images to `clickhouse-local.md` which is
42+
located at `/docs/chdb/guides/clickhouse-local.md`. You should add the
43+
images at `/static/images/chdb/guides/`.
44+
45+
Try to use descriptive names in lower case. For example:
46+
- `clickhouse-local-1.png`
47+
- `clickhouse-local-2.png`
48+
- `clickhouse-local-3.png` etc.
49+
50+
In the markdown document import the images under the YAML frontmatter:
51+
52+
```markdown
53+
---
54+
title: Using a clickhouse-local database
55+
sidebar_label: Using clickhouse-local database
56+
slug: /chdb/guides/clickhouse-local
57+
description: Learn how to use a clickhouse-local database with chDB
58+
keywords: [chdb, clickhouse-local]
59+
---
60+
61+
import clickhouse-local-1 from '@site/static/images/chdb/guides/clickhouse-local-1.png'
62+
import clickhouse-local-2 from '@site/static/images/chdb/guides/clickhouse-local-2.png'
63+
import clickhouse-local-3 from '@site/static/images/chdb/guides/clickhouse-local-3.png'
64+
```
65+
66+
Use the `<img/>` tag to place your image in the appropriate place:
67+
68+
```markdown
69+
Here is some example text which refers to the image below:
70+
71+
<img src={clickhouse-local-1}
72+
alt='DESCRIPTION OF THE IMAGE'
73+
style={{width: '800px'}} // optional
74+
/>
75+
76+
Here is another paragraph...
77+
```
78+
79+
## Codeblocks
80+
81+
Codeblocks are defined using backticks. For example:
82+
83+
```text
84+
\```sql title='Query'
85+
SELECT * FROM system.contributors;
86+
\```
87+
```
88+
89+
Code blocks:
90+
- Should always have a language defined immediately next to the opening 3
91+
backticks, without any space.
92+
- Have a title (optional) such as 'Query' or 'Response'
93+
- Use language `response` if it is for the result of a query.
94+
95+
### Associated markdown rule or CI check
96+
97+
- [`MD040` enforces that codeblocks have a language specified](/scripts/.markdownlint-cli2.yaml)
98+
99+
## Broken links
100+
101+
Making a change to a page slug or moving a file can result in broken links in
102+
numerous places across the docs. To mitigate this we use the built in link checker
103+
provided by Docusaurus. If broken links are found then docs check will fail with
104+
an error message something like this:
105+
106+
```text
107+
Exhaustive list of all broken links found:
108+
109+
- Broken link on source page path = /docs/observability/integrating-opentelemetry:
110+
-> linking to /docs/observability/schema-design#using-maps
111+
- Broken link on source page path = /docs/operations/server-configuration-parameters/settings:
112+
-> linking to ../../../engines/table-engines/mergetree-family/mergetree#mergetree-table-ttl (resolved as: /engines/table-engines/mergetree-family/mergetree#mergetree-table-ttl)
113+
- Broken link on source page path = /docs/partitions:
114+
-> linking to /docs/optimize/sparse-primary-indexes#data-is-organized-into-granules-for-parallel-data-processing
115+
```
116+
117+
To fix the links, find the source page, given after `source page path =` and search within it for the
118+
link given after `linking to`. As slugs are resolved relative to `/docs` you can exclude this from your
119+
search. E.g don't search `/docs/observability/schema-design#using-maps` but `/observability/schema-design#using-maps`
120+
121+
**note** if you can't find the link on the page but you're sure that you are looking in the file
122+
reported by the failing broken link checker, the link is most likely found in a snippet which is
123+
imported by that page. Find the snippet location from the import statement at the top of the page.
124+
125+
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,52 @@
11

2+
import GCS_bucket_1 from '@site/static/images/integrations/data-ingestion/s3/GCS-bucket-1.png';
3+
import GCS_bucket_2 from '@site/static/images/integrations/data-ingestion/s3/GCS-bucket-2.png';
4+
import GCS_create_service_account_key from '@site/static/images/integrations/data-ingestion/s3/GCS-create-a-service-account-key.png';
5+
import GCS_create_service_account_0 from '@site/static/images/integrations/data-ingestion/s3/GCS-create-service-account-0.png';
6+
import GCS_create_service_account_a from '@site/static/images/integrations/data-ingestion/s3/GCS-create-service-account-a.png';
7+
import GCS_create_service_account_2 from '@site/static/images/integrations/data-ingestion/s3/GCS-create-service-account-2.png';
8+
import GCS_create_service_account_3 from '@site/static/images/integrations/data-ingestion/s3/GCS-create-service-account-3.png';
9+
import GCS_guide_key from '@site/static/images/integrations/data-ingestion/s3/GCS-guide-key.png';
10+
211
<details>
312
<summary>Create GCS buckets and an HMAC key</summary>
413

514
### ch_bucket_us_east1 {#ch_bucket_us_east1}
615

7-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-bucket-1.png)
16+
<img src={GCS_bucket_1} alt="Creating a GCS bucket in US East 1" />
817

918
### ch_bucket_us_east4 {#ch_bucket_us_east4}
1019

11-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-bucket-2.png)
20+
<img src={GCS_bucket_2} alt="Creating a GCS bucket in US East 4" />
1221

1322
### Generate an Access key {#generate-an-access-key}
1423

1524
### Create a service account HMAC key and secret {#create-a-service-account-hmac-key-and-secret}
1625

1726
Open **Cloud Storage > Settings > Interoperability** and either choose an existing **Access key**, or **CREATE A KEY FOR A SERVICE ACCOUNT**. This guide covers the path for creating a new key for a new service account.
1827

19-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-create-a-service-account-key.png)
28+
<img src={GCS_create_service_account_key} alt="Generating a service account HMAC key in GCS" />
2029

2130
### Add a new service account {#add-a-new-service-account}
2231

2332
If this is a project with no existing service account, **CREATE NEW ACCOUNT**.
2433

25-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-create-service-account-0.png)
34+
<img src={GCS_create_service_account_0} alt="Adding a new service account in GCS" />
2635

2736
There are three steps to creating the service account, in the first step give the account a meaningful name, ID, and description.
2837

29-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-create-service-account-a.png)
38+
<img src={GCS_create_service_account_a} alt="Defining a new service account name and ID in GCS" />
3039

3140
In the Interoperability settings dialog the IAM role **Storage Object Admin** role is recommended; select that role in step two.
3241

33-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-create-service-account-2.png)
42+
<img src={GCS_create_service_account_2} alt="Selecting IAM role Storage Object Admin in GCS" />
3443

3544
Step three is optional and not used in this guide. You may allow users to have these privileges based on your policies.
3645

37-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-create-service-account-3.png)
46+
<img src={GCS_create_service_account_3} alt="Configuring additional settings for the new service account in GCS" />
3847

3948
The service account HMAC key will be displayed. Save this information, as it will be used in the ClickHouse configuration.
4049

41-
![Add a bucket](@site/docs/integrations/data-ingestion/s3/images/GCS-guide-key.png)
50+
<img src={GCS_guide_key} alt="Retrieving the generated HMAC key for GCS" />
4251

4352
</details>

0 commit comments

Comments
 (0)