You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`type`| Engine type name - must be `risingwave`| string | Y |
10
+
|`host`| The hostname of the RisingWave engine | string | Y |
11
+
|`user`| The username to use for authentication with the RisingWave engine | string | Y |
12
+
|`password`| The password to use for authentication with the RisingWave engine | string | N |
13
+
|`port`| The port number of the RisingWave engine server | int | Y |
14
+
|`database`| The name of the database instance to connect to | string | Y |
15
+
|`role`| The role to use for authentication with the RisingWave server | string | N |
16
+
|`sslmode`| The security of the connection to the RisingWave server | string | N |
17
+
18
+
## Usage
19
+
RisingWave engine has some different features as streaming database. You can create a resource that RisingWave can read data from with `CREATE SOURCE`. You can also create an external target where you can send data processed in RisingWave with `CREATE SINK`.
20
+
21
+
To use this in SQLMesh, you can refer to optional pre-statements and post-statements as [SQL models doc](https://sqlmesh.readthedocs.io/en/stable/concepts/models/sql_models/) here specify.
22
+
23
+
Below is an example of creating sink in SQLMesh models as post-statement.
24
+
25
+
```sql
26
+
MODEL (
27
+
name sqlmesh_example.view_model,
28
+
kind VIEW (
29
+
materialized true
30
+
)
31
+
);
32
+
33
+
SELECT
34
+
item_id,
35
+
COUNT(DISTINCT id) AS num_orders,
36
+
FROM
37
+
sqlmesh_example.incremental_model
38
+
GROUP BY item_id;
39
+
40
+
CREATE
41
+
SINK IF NOT EXISTS kafka_sink
42
+
FROM
43
+
@this_model
44
+
WITH (
45
+
connector='kafka',
46
+
"properties.bootstrap.server"='localhost:9092',
47
+
topic='test1',
48
+
)
49
+
FORMAT PLAIN
50
+
ENCODE JSON (force_append_only=true);
51
+
```
52
+
53
+
here `@this_model` macro is used to represent "sqlmesh_example.view_model" model.
0 commit comments