Package org.apache.calcite.model
Class JsonView
java.lang.Object
org.apache.calcite.model.JsonTable
org.apache.calcite.model.JsonView
View schema element.
Like base class JsonTable
,
occurs within JsonMapSchema.tables
.
Modifiable views
A view is modifiable if contains only SELECT, FROM, WHERE (no JOIN, aggregation or sub-queries) and every column:
- is specified once in the SELECT clause; or
- occurs in the WHERE clause with a column = literal predicate; or
- is nullable.
The second clause allows Calcite to automatically provide the correct
value for hidden columns. It is useful in, say, a multi-tenant environment,
where the tenantId
column is hidden, mandatory (NOT NULL), and has a
constant value for a particular view.
Errors regarding modifiable views:
- If a view is marked modifiable: true and is not modifiable, Calcite throws an error while reading the schema.
- If you submit an INSERT, UPDATE or UPSERT command to a non-modifiable view, Calcite throws an error when validating the statement.
- If a DML statement creates a row that would not appear in the view (for example, a row in female_emps, above, with gender = 'M'), Calcite throws an error when executing the statement.
- See Also:
-
Field Details
-
sql
SQL query that is the definition of the view.Must be a string or a list of strings (which are concatenated into a multi-line SQL string, separated by newlines).
-
path
Schema name(s) to use when resolving query.If not specified, defaults to current schema.
-
modifiable
Whether this view should allow INSERT requests.The values have the following meanings:
- If true, Calcite throws an error when validating the schema if the view is not modifiable.
- If null, Calcite deduces whether the view is modifiable.
- If false, Calcite will not allow inserts.
The default value is
null
.
-
-
Constructor Details
-
JsonView
-
-
Method Details