Skip to content

Commit 0631fe0

Browse files
fix: apply suggestions from code review
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
1 parent 1928996 commit 0631fe0

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

sqlmesh/core/engine_adapter/risingwave.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ def columns(
5353
)
5454
)
5555

56-
if table.args.get("db"):
57-
sql = sql.where(
58-
exp.column("name", table="rw_schemas", quoted=False).eq(table.args["db"].name)
59-
)
56+
if table.db:
57+
sql = sql.where(exp.column("name", table="rw_schemas").eq(table.db))
6058

6159
self.execute(sql)
6260
resp = self.cursor.fetchall()

tests/core/engine_adapter/integration/test_integration_risingwave.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,11 @@ def test_engine_adapter_columns(
7070
ctx: TestContext, risingwave_columns_with_datatypes: t.Dict[str, exp.DataType]
7171
):
7272
table = ctx.table("TEST_COLUMNS")
73-
query_cols: t.List[str] = [
74-
f"NULL::{data_type.sql(dialect='risingwave')} AS {col_name}"
75-
for col_name, data_type in risingwave_columns_with_datatypes.items()
76-
]
77-
query: exp.Query = exp.maybe_parse(
78-
f"""
79-
SELECT
80-
{",".join(query_cols)}
81-
""",
82-
dialect="risingwave",
73+
query = exp.select(
74+
*[
75+
exp.cast(exp.null(), dtype).as_(name)
76+
for name, dtype in risingwave_columns_with_datatypes.items()
77+
]
8378
)
8479
ctx.engine_adapter.ctas(table, query)
8580

0 commit comments

Comments
 (0)