Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ workflows:
name: cloud_engine_<< matrix.engine >>
context:
- sqlmesh_cloud_database_integration
requires:
- engine_tests_docker
# requires:
# - engine_tests_docker
matrix:
parameters:
engine:
Expand All @@ -313,10 +313,10 @@ workflows:
- athena
- fabric
- gcp-postgres
filters:
branches:
only:
- main
# filters:
# branches:
# only:
# - main
- ui_style
- ui_test
- vscode_test
Expand Down
8 changes: 4 additions & 4 deletions sqlmesh/dbt/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,10 @@ def to_sqlmesh(
)
else:
model_kwargs["start"] = begin
# If user explicitly disables concurrent batches then we want to set depends on past to true which we
# will do by including the model in the depends_on
# If user explicitly disables concurrent batches then force sequential execution by setting batch_concurrency to 1
if self.concurrent_batches is not None and self.concurrent_batches is False:
depends_on = model_kwargs.get("depends_on", set())
depends_on.add(self.canonical_name(context))
if hasattr(kind, "batch_concurrency"):
kind.batch_concurrency = 1

model_kwargs["start"] = model_kwargs.get(
"start", context.sqlmesh_config.model_defaults.start
Expand All @@ -768,6 +767,7 @@ def to_sqlmesh(
allow_partials=allow_partials,
virtual_environment_mode=virtual_environment_mode,
dbt_node_info=self.node_info,
optimize_query=False,
**optional_kwargs,
**model_kwargs,
)
Expand Down
23 changes: 0 additions & 23 deletions tests/core/integration/test_dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import typing as t
import pytest
from sqlmesh.core.model.common import ParsableSql
import time_machine

from sqlmesh.core.context import Context
Expand All @@ -11,7 +10,6 @@
)
from sqlmesh.core.snapshot import (
DeployabilityIndex,
SnapshotChangeCategory,
)

if t.TYPE_CHECKING:
Expand All @@ -20,27 +18,6 @@
pytestmark = pytest.mark.slow


@time_machine.travel("2023-01-08 15:00:00 UTC")
def test_dbt_select_star_is_directly_modified(sushi_test_dbt_context: Context):
context = sushi_test_dbt_context

model = context.get_model("sushi.simple_model_a")
context.upsert_model(
model,
query_=ParsableSql(sql="SELECT 1 AS a, 2 AS b"),
)

snapshot_a_id = context.get_snapshot("sushi.simple_model_a").snapshot_id # type: ignore
snapshot_b_id = context.get_snapshot("sushi.simple_model_b").snapshot_id # type: ignore

plan = context.plan_builder("dev", skip_tests=True).build()
assert plan.directly_modified == {snapshot_a_id, snapshot_b_id}
assert {i.snapshot_id for i in plan.missing_intervals} == {snapshot_a_id, snapshot_b_id}

assert plan.snapshots[snapshot_a_id].change_category == SnapshotChangeCategory.NON_BREAKING
assert plan.snapshots[snapshot_b_id].change_category == SnapshotChangeCategory.NON_BREAKING


@time_machine.travel("2023-01-08 15:00:00 UTC")
def test_dbt_is_incremental_table_is_missing(sushi_test_dbt_context: Context):
context = sushi_test_dbt_context
Expand Down
2 changes: 1 addition & 1 deletion tests/core/integration/test_multi_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def test_multi_hybrid(mocker):
sqlmesh_rendered = (
'SELECT "e"."col_a" AS "col_a", "e"."col_b" AS "col_b" FROM "memory"."dbt_repo"."e" AS "e"'
)
dbt_rendered = 'SELECT DISTINCT ROUND(CAST(("b"."col_a" / NULLIF(100, 0)) AS DECIMAL(16, 2)), 2) AS "rounded_col_a" FROM "memory"."sqlmesh_repo"."b" AS "b"'
dbt_rendered = 'SELECT DISTINCT ROUND(CAST(("col_a" / NULLIF(100, 0)) AS DECIMAL(16, 2)), 2) AS "rounded_col_a" FROM "memory"."sqlmesh_repo"."b" AS "b"'
assert sqlmesh_model_a.render_query().sql() == sqlmesh_rendered
assert dbt_model_c.render_query().sql() == dbt_rendered

Expand Down
9 changes: 5 additions & 4 deletions tests/dbt/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ def test_load_microbatch_all_defined_diff_values(
column=exp.to_column("blah", quoted=True), format="%Y-%m-%d"
)
assert model.kind.batch_size == 1
assert model.depends_on_self is True
assert model.kind.batch_concurrency == 1
assert model.depends_on_self is False


@pytest.mark.slow
Expand Down Expand Up @@ -630,7 +631,7 @@ def test_load_microbatch_with_ref(
)
assert (
context.render(microbatch_two_snapshot_fqn, start="2025-01-01", end="2025-01-10").sql()
== 'SELECT "_q_0"."cola" AS "cola", "_q_0"."ds" AS "ds" FROM (SELECT "microbatch"."cola" AS "cola", "microbatch"."ds" AS "ds" FROM "local"."main"."microbatch" AS "microbatch" WHERE "microbatch"."ds" < \'2025-01-11 00:00:00+00:00\' AND "microbatch"."ds" >= \'2025-01-01 00:00:00+00:00\') AS "_q_0"'
== 'SELECT "cola" AS "cola", "ds" AS "ds" FROM (SELECT * FROM "local"."main"."microbatch" AS "microbatch" WHERE "ds" >= \'2025-01-01 00:00:00+00:00\' AND "ds" < \'2025-01-11 00:00:00+00:00\') AS "_q_0"'
)


Expand Down Expand Up @@ -696,7 +697,7 @@ def test_load_microbatch_with_ref_no_filter(
)
assert (
context.render(microbatch_two_snapshot_fqn, start="2025-01-01", end="2025-01-10").sql()
== 'SELECT "microbatch"."cola" AS "cola", "microbatch"."ds" AS "ds" FROM "local"."main"."microbatch" AS "microbatch"'
== 'SELECT "cola" AS "cola", "ds" AS "ds" FROM "local"."main"."microbatch" AS "microbatch"'
)


Expand Down Expand Up @@ -1104,7 +1105,7 @@ def test_conditional_ref_in_unexecuted_branch(copy_to_temp_path: t.Callable):
assert rendered is not None
assert (
rendered.sql()
== 'WITH "source" AS (SELECT "simple_model_a"."a" AS "a" FROM "memory"."sushi"."simple_model_a" AS "simple_model_a") SELECT "source"."a" AS "a" FROM "source" AS "source"'
== 'WITH "source" AS (SELECT * FROM "memory"."sushi"."simple_model_a" AS "simple_model_a") SELECT * FROM "source" AS "source"'
)

# And run plan with this conditional model for good measure
Expand Down