Skip to content

Commit 32462e8

Browse files
author
Christophe Di Prima
committed
feat(risingwave): add support for include in create_source
1 parent bb9a84f commit 32462e8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ibis/backends/risingwave/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,9 @@ def create_source(
764764
The encode format for the new source, e.g., "JSON". data_format and encode_format must be specified at the same time.
765765
encode_properties
766766
The properties of encode format, providing information like schema registry url. Refer https://docs.risingwave.com/docs/current/sql-create-source/ for more details.
767-
767+
includes
768+
A dict of INCLUDE clauses. Set the value to None if no alias is needed. Refer https://docs.risingwave.com/docs/current/sql-create-source/ for more details.
769+
768770
Returns
769771
-------
770772
Table
@@ -773,11 +775,19 @@ def create_source(
773775
table = sg.table(name, db=database, quoted=self.compiler.quoted)
774776
target = sge.Schema(this=table, expressions=schema.to_sqlglot(self.dialect))
775777

778+
include_clauses = []
779+
if includes:
780+
for include_type, column_name in includes.items():
781+
include_clauses.append(sge.IncludeProperty(this=sg.column(include_type), alias=sg.column(column_name) if column_name else None))
782+
776783
create_stmt = sge.Create(
777784
kind="SOURCE",
778785
this=target,
779786
properties=sge.Properties(
780-
expressions=sge.Properties.from_dict(connector_properties)
787+
expressions=[
788+
*include_clauses,
789+
*sge.Properties.from_dict(connector_properties)
790+
]
781791
),
782792
)
783793

0 commit comments

Comments
 (0)