Skip to content

Commit dc46d73

Browse files
authored
remove distinct (#1371)
1 parent c41e74f commit dc46d73

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

sqlmesh/core/engine_adapter/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,9 @@ def scd_type_2(
811811
exp.Select() # type: ignore
812812
.with_(
813813
"source",
814-
exp.select(*unmanaged_columns)
815-
.distinct(*unique_key)
816-
.from_(source_table.subquery("raw_source")), # type: ignore
814+
exp.select(*unmanaged_columns).from_(
815+
source_table.subquery("raw_source") # type: ignore
816+
),
817817
)
818818
# Historical Records that Do Not Change
819819
.with_(
@@ -1099,6 +1099,8 @@ def execute(
10991099
if isinstance(e, exp.Expression)
11001100
else e
11011101
)
1102+
logger.error("THE SQL: %s", sql)
1103+
print(sql)
11021104
logger.debug(f"Executing SQL:\n{sql}")
11031105
self.cursor.execute(sql, **kwargs)
11041106

tests/core/engine_adapter/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def test_scd_type_2(make_mocked_engine_adapter: t.Callable):
732732
"""
733733
CREATE OR REPLACE TABLE "target" AS
734734
WITH "source" AS (
735-
SELECT DISTINCT ON ("id")
735+
SELECT
736736
"id",
737737
"name",
738738
"price",
@@ -884,7 +884,7 @@ def test_merge_scd_type_2_pandas(make_mocked_engine_adapter: t.Callable):
884884
"""
885885
CREATE OR REPLACE TABLE "target" AS
886886
WITH "source" AS (
887-
SELECT DISTINCT ON ("id1", "id2")
887+
SELECT
888888
"id1",
889889
"id2",
890890
"name",

0 commit comments

Comments
 (0)