Improve param view docs

This commit is contained in:
Dmitry Novik 2024-09-02 16:16:46 +02:00
parent 34ceebe992
commit 355d7bce05

View File

@ -41,15 +41,24 @@ SELECT a, b, c FROM (SELECT ...)
## Parameterized View
Parametrized views are similar to normal views, but can be created with parameters which are not resolved immediately. These views can be used with table functions, which specify the name of the view as function name and the parameter values as its arguments.
Parametrized views are similar to normal views, but can be created with parameters which are not resolved immediately.
These views can be used with table functions, which specify the name of the view as function name and the parameter values as its arguments.
``` sql
CREATE VIEW view AS SELECT * FROM TABLE WHERE Column1={column1:datatype1} and Column2={column2:datatype2} ...
CREATE VIEW param_view AS SELECT * FROM TABLE WHERE Column1={column1:datatype1} and Column2={column2:datatype2} ...
```
The above creates a view for table which can be used as table function by substituting parameters as shown below.
``` sql
SELECT * FROM view(column1=value1, column2=value2 ...)
SELECT * FROM param_view(column1=value1, column2=value2 ...)
```
Since the parameterized view depends on the parameter values, it doesn't have a schema when parameters are not provided.
That means there's no information about parameterized views in the `system.columns` table.
Also, `DESCRIBE` queries would work only if parameters are provided.
```sql
DESCRIBE param_view(column1=value1, column2=value2 ...)
```
## Materialized View