Skip to content

Commit 5c60eaa

Browse files
authored
Docs: add database permissions to ClickHouse docs (#4581)
1 parent e61131a commit 5c60eaa

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

docs/integrations/engines/clickhouse.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,35 @@ ClickHouse Cloud automates ClickHouse's cluster controls, which sometimes constr
5959

6060
Aside from those constraints, ClickHouse Cloud mode is similar to single server mode - you run standard SQL commands/queries, and ClickHouse Cloud executes them.
6161

62+
## Permissions
63+
64+
In the default SQLMesh configuration, users must have sufficient permissions to create new ClickHouse databases.
65+
66+
Alternatively, you can configure specific databases where SQLMesh should create table and view objects.
67+
68+
### Environment views
69+
70+
Use the [`environment_suffix_target` key in your project configuration](../../guides/configuration.md#disable-environment-specific-schemas) to specify that environment views should be created within the model's database instead of in a new database:
71+
72+
``` yaml
73+
environment_suffix_target: table
74+
```
75+
76+
### Physical tables
77+
78+
Use the [`physical_schema_mapping` key in your project configuration](../../guides/configuration.md#physical-table-schemas) to specify the databases where physical tables should be created.
79+
80+
The key accepts a dictionary of regular expressions that map model database names to the corresponding databases where physical tables should be created.
81+
82+
SQLMesh will compare a model's database name to each regular expression and use the first match to determine which database a physical table should be created in.
83+
84+
For example, this configuration places every model's physical table in the `model_physical_tables` database because the regular expression `.*` matches any database name:
85+
86+
``` yaml
87+
physical_schema_mapping:
88+
'.*': model_physical_tables
89+
```
90+
6291
## Cluster specification
6392

6493
A ClickHouse cluster allows multiple networked ClickHouse servers to operate on the same data object. Every cluster must be named in the ClickHouse configuration files, and that name is passed to a table's DDL statements in the `ON CLUSTER` clause.

docs/reference/model_configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Configuration options for SQLMesh model properties. Supported by all model kinds
4141
| `optimize_query` | Whether the model's query should be optimized. This attribute is `true` by default. Setting it to `false` causes SQLMesh to disable query canonicalization & simplification. This should be turned off only if the optimized query leads to errors such as surpassing text limit. | bool | N |
4242
| `ignored_rules` | A list of linter rule names (or "ALL") to be ignored/excluded for this model | str \| array[str] | N |
4343
| `formatting` | Whether the model will be formatted. All models are formatted by default. Setting this to `false` causes SQLMesh to ignore this model during `sqlmesh format`. | bool | N |
44+
4445
### Model defaults
4546

4647
The SQLMesh project-level configuration must contain the `model_defaults` key and must specify a value for its `dialect` key. Other values are set automatically unless explicitly overridden in the model definition. Learn more about project-level configuration in the [configuration guide](../guides/configuration.md).

0 commit comments

Comments
 (0)