Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
b4a8770
wip: failing E2E for compiling a project that still uses @task (paused)
kvlonge Nov 18, 2026
bcbed74
Merge remote-tracking branch 'origin/main' into feat/project-layout-a…
kvlonge Nov 19, 2026
e94b6a3
wip: remove the task node kind in favour of assets (tests in progress)
kvlonge Nov 19, 2026
19e5968
wip: move unit tests and the materialized guard off the task kind
kvlonge Nov 19, 2026
99e1230
wip: finish moving tests, docs and goldens off the task kind
kvlonge Nov 19, 2026
fc5e002
Merge remote-tracking branch 'origin/main' into feat/asset-only-pytho…
kvlonge Nov 20, 2026
cf4bd48
feat!: remove the task kind from the UI, events and remaining tests
kvlonge Nov 20, 2026
21e413b
fix: keep stored Python task attempts readable and drop task from mes…
kvlonge Nov 20, 2026
ee6fb97
chore: record the Python node kind parser as an intentional mirror
kvlonge Nov 20, 2026
7532721
style: format the integration result kinds
kvlonge Nov 20, 2026
ae427d3
style: format and keep the retired-name doc comment on one line
kvlonge Nov 20, 2026
9a241d1
Merge remote-tracking branch 'origin/main' into feat/asset-only-pytho…
kvlonge Nov 20, 2026
d56c0af
test: move the node-unit fixture from @sqlbuild.task to @sqlbuild.asset
kvlonge Nov 21, 2026
abc34d9
Merge remote-tracking branch 'origin/main' into feat/asset-only-pytho…
kvlonge Nov 21, 2026
708b5b2
test: restore the mistyped ctx in the node-signature rule fixture and…
kvlonge Nov 21, 2026
d3981f1
test: move E2E expectations from the task kind to assets
kvlonge Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions benchmarks/duckshop/edge_cases/loaders/loader_results.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Two loaders and a task that reads both of their results.
"""Two loaders and an asset that reads both of their results.

A build that selects only one loader still reads the other loader's latest result, which may come
from an earlier build. On Snowflake the adapter has no default schema, so the results must go to
the target's schema for the task to find them.
the target's schema for the asset to find them.
"""

from sqlbuild.assets import asset
from sqlbuild.executor.load.models import LoaderContext
from sqlbuild.loaders import loader
from sqlbuild.refs import source
from sqlbuild.tasks import task


@loader
Expand All @@ -23,7 +23,7 @@ def raw_customer_events(ctx: LoaderContext) -> list[dict[str, object]]:
return [{"event_id": 1}]


@task(depends_on=[source("raw_order_events"), source("raw_customer_events")])
@asset(depends_on=[source("raw_order_events"), source("raw_customer_events")])
def announce_events(ctx):
"""Record the run each loader result came from."""
return ctx.result(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from sqlbuild.assets import asset
from sqlbuild.refs import model
from sqlbuild.tasks import task


@task(depends_on=model("orders"))
@asset(depends_on=model("orders"))
def score_orders(ctx):
"""Send the orders to the partner and keep the scores it returns."""
relation = ctx.relation(model("orders"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from sqlbuild.assets import asset
from sqlbuild.refs import model
from sqlbuild.tasks import task


@task(depends_on=model("scored_orders"))
@asset(depends_on=model("scored_orders"))
def score_orders(ctx):
"""Send the scored orders to the partner."""
return ctx.result(payload={})
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from python.loaders.partner import partner_scores

from sqlbuild.tasks import task
from sqlbuild.assets import asset


@task(depends_on=[partner_scores])
@asset(depends_on=[partner_scores])
def report_scores(ctx):
"""Report the scores the partner returned."""
return ctx.result(payload={})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from sqlbuild.tasks import task
from sqlbuild.assets import asset


@task()
@asset()
def score_orders(ctx):
"""Fetch the partner scores."""
return ctx.result(payload={})
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

@loader(depends_on=[score_orders, fetch_rates])
def partner_scores(ctx):
"""Load the scores, gated by a read-side task and an ingress task."""
"""Load the scores, gated by a read-side asset and an ingress asset."""
result = ctx.result_of(node_function=score_orders)
return [{"order_id": o, "score": s} for o, s in result.payload["scores"]]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from sqlbuild.tasks import task
from sqlbuild.assets import asset


@task()
@asset()
def fetch_rates(ctx):
"""Fetch the partner's rates; reads no SQL, so it runs before the build's SQL."""
return ctx.result(payload={"rate": 10})
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from python.tasks.scoring import score_orders

from sqlbuild.tasks import task
from sqlbuild.assets import asset


@task(depends_on=[score_orders])
@asset(depends_on=[score_orders])
def package_scores(ctx):
"""Package the partner's scores; skips softly when there is nothing new to send."""
return ctx.skip(reason="nothing to package")
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"record": {
"state_database": null,
"state_schema": "main",
"node_type": "task",
"node_type": "asset",
"node_name": "result-000",
"target_database": null,
"target_schema": "main",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"initial": "from sqlbuild.checks import check\nfrom sqlbuild.refs import model\n@check(depends_on=model('orders'), description='Orders are present.')\ndef orders_present(ctx):\n return ctx.pass_()\n",
"changed": "from sqlbuild.checks import check\nfrom sqlbuild.refs import model\n@check(depends_on=model('orders'), description='Orders are present.')\ndef orders_present(ctx):\n raise RuntimeError('changed check executed after publication')\n",
"task": "from sqlbuild.tasks import task\n@task(description='Notify support.')\ndef notify_support(ctx):\n return None\n",
"side_effect": "from sqlbuild.assets import asset\n@asset(description='Notify support.')\ndef notify_support(ctx):\n return None\n",
"asset": "from sqlbuild.assets import asset\n@asset(description='Order export.')\ndef order_export(ctx):\n return []\n"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Jobs whose selections are Python nodes, which `--select job:<name>` must select as published.
name = "customer_counts_job"
description = "Count customers."
select = "task:count_customers asset:customers_extract"
select = "asset:count_customers asset:customers_extract"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name = "order_counts_job"
description = "Count orders."
select = "+task:count_orders"
select = "+asset:count_orders"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from python.orders.partner_export.node import partner_orders_file

from sqlbuild.tasks import task
from sqlbuild.assets import asset


@task(depends_on=partner_orders_file, tags=["orders"], description="Book collection.")
@asset(depends_on=partner_orders_file, tags=["orders"], description="Book collection.")
def request_carrier_collection(ctx):
return None
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Write each shipped order as one carrier line."""

from python.utils.currency import amounts
from sqlbuild.assets import AssetContext
from sqlbuild.executor.python_nodes.models import PythonNodeResult
from sqlbuild.tasks import TaskContext


def main(ctx: TaskContext) -> PythonNodeResult:
def main(ctx: AssetContext) -> PythonNodeResult:
"""Write each shipped order as one carrier line."""
label: str = "Expédition"
return ctx.result(payload=f"{label} {amounts.cents_text(1250)}")
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Export shipped orders to the carrier."""

from python.fulfillment.shipment_export.main import main
from sqlbuild.assets import AssetContext, asset
from sqlbuild.executor.python_nodes.models import PythonNodeResult
from sqlbuild.tasks import TaskContext, task


@task(description="Export shipped orders to the carrier.")
def shipment_export(ctx: TaskContext) -> PythonNodeResult:
@asset(description="Export shipped orders to the carrier.")
def shipment_export(ctx: AssetContext) -> PythonNodeResult:
return main(ctx=ctx)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Replenishment declared in a flat module."""

from sqlbuild.tasks import TaskContext, task
from sqlbuild.assets import AssetContext, asset


@task(description="Reorder products that ran out.")
def replenish(ctx: TaskContext) -> None:
@asset(description="Reorder products that ran out.")
def replenish(ctx: AssetContext) -> None:
return None
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from orchestration.sensors.fulfillment._helpers.hours import CUTOFF_HOURS

from sqlbuild.tasks import TaskContext, task
from sqlbuild.assets import AssetContext, asset

WAREHOUSES: tuple[str, ...] = ("north", "south")


@task
def stock_count(context: TaskContext) -> int:
@asset
def stock_count(context: AssetContext) -> int:
"""Count stock in every warehouse."""
return len(WAREHOUSES) + CUTOFF_HOURS
4 changes: 2 additions & 2 deletions clients/typescript/src/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3010,7 +3010,7 @@ export interface components {
state_database?: string | null;
state_schema: string;
};
/** @description Code that injects a provider: a node (`loader`, `task`, `asset`, `check`, `hook` or `materialization`, keyed `kind:name`), an `event_exporter` or a `sink`. */
/** @description Code that injects a provider: a node (`loader`, `asset`, `check`, `hook` or `materialization`, keyed `kind:name`), an `event_exporter` or a `sink`. */
ProviderConsumer: {
kind: string;
name: string;
Expand Down Expand Up @@ -3703,7 +3703,7 @@ export interface components {
index: number;
/** @description The part as typed, such as `+tag:finanse`. */
part: string;
/** @description `tag`, `path`, `job`, `source`, `seed`, `kind`, `test`, `name`, `glob`, or a Python node type such as `task`. */
/** @description `tag`, `path`, `job`, `source`, `seed`, `kind`, `test`, `name`, `glob`, or a Python node type such as `asset`. */
type: string;
/** @description The value the part names, without its type prefix or `+` markers, such as `finanse`. */
value: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn target_error_message(error: &TargetError) -> String {
),
TargetError::PreservedNodeResults(target) => format!(
"Target '{target}' keeps each model's own schema, so it has no schema for the \
results of loaders, tasks, assets and checks. Set targets.{target}.loader_schema; \
results of loaders, assets and checks. Set targets.{target}.loader_schema; \
Python node results are kept there."
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ pub(crate) fn model_node(model: &DagModelInput) -> DagValue {
.value()
}

/// The node of a Python task, asset or check.
/// The node of a Python asset or check.
pub(crate) fn python_node(node: &DagPythonNodeInput) -> DagValue {
let mut fields: NodeFields = NodeFields {
id: python_node_id(&node.kind, &node.name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ fn given_project_when_building_dag_json_then_python_artifact_agrees() {
}

#[test]
fn given_a_loader_depending_on_a_task_when_building_dag_json_then_the_edge_reaches_its_source() {
fn given_a_loader_depending_on_an_asset_when_building_dag_json_then_the_edge_reaches_its_source() {
let test_cases = [DagEdgeTestCase {
description: "a task upstream of a declared loader points at the loader's source",
description: "an asset upstream of a declared loader points at the loader's source",
project: DagProjectInput {
sources: vec![source(
"partner_scores",
Expand All @@ -190,18 +190,18 @@ fn given_a_loader_depending_on_a_task_when_building_dag_json_then_the_edge_reach
},
python: DagPythonGraphInput {
nodes: vec![
python_node("task", "score_orders", vec![key("model", "orders")]),
python_node("asset", "score_orders", vec![key("model", "orders")]),
python_node("loader", "partner_scores", Vec::new()),
],
dependency_edges: vec![("score_orders".to_owned(), "partner_scores".to_owned())],
kinds_by_name: vec![
("score_orders".to_owned(), "task".to_owned()),
("score_orders".to_owned(), "asset".to_owned()),
("partner_scores".to_owned(), "loader".to_owned()),
],
},
expected_edges: &[
("model:orders", "task:score_orders"),
("task:score_orders", "source:partner_scores"),
("asset:score_orders", "source:partner_scores"),
("model:orders", "asset:score_orders"),
],
}];
for test_case in test_cases {
Expand Down
5 changes: 2 additions & 3 deletions crates/sqlbuild-analysis/src/definition_changes/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub const DEPENDENCIES_KIND: &str = "dependencies";
/// The one node of each project-wide kind.
pub const PROJECT_NODE_NAME: &str = "project";
/// Python nodes by decorator.
pub const PYTHON_NODE_KINDS: [&str; 4] = ["loader", "task", "asset", "check"];
pub const PYTHON_NODE_KINDS: [&str; 3] = ["loader", "asset", "check"];

/// Normalised SQL of a model, a function body or a scenario.
pub const SQL_ASPECT: &str = "sql";
Expand Down Expand Up @@ -54,7 +54,7 @@ pub(crate) const ASPECT_LABELS: [(&str, &str); 8] = [
];

/// How each node kind reads in summaries: singular, plural.
pub(crate) const KIND_LABELS: [(&str, &str, &str); 23] = [
pub(crate) const KIND_LABELS: [(&str, &str, &str); 22] = [
(SETTINGS_KIND, "project settings", "project settings"),
(
CONNECTION_KIND,
Expand All @@ -81,7 +81,6 @@ pub(crate) const KIND_LABELS: [(&str, &str, &str); 23] = [
("python_hook", "Python hook", "Python hooks"),
(MATERIALIZATION_KIND, "materialization", "materializations"),
("loader", "loader", "loaders"),
("task", "task", "tasks"),
("asset", "asset", "assets"),
("check", "check", "checks"),
(TEST_FILE_KIND, "test file", "test files"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn relation_remedy(
if kind != SOURCE_TYPE {
return format!(
"loaders run before models and seeds and cannot read them; read \
{kind}:{name} from a task or asset instead"
{kind}:{name} from an asset instead"
);
}
return match upstream_loaders.iter().find(|(source, _)| source == name) {
Expand Down
2 changes: 1 addition & 1 deletion crates/sqlbuild-analysis/src/explicit_references/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct ReferenceRequest {
pub audits: Vec<AuditGate>,
/// `project.hook_functions` in order.
pub hooks: Vec<PythonHook>,
/// Python SQL owners: tasks, assets, checks, loaders, then hooks.
/// Python SQL owners: assets, checks, loaders, then hooks.
pub owners: Vec<SqlOwner>,
}

Expand Down
6 changes: 3 additions & 3 deletions crates/sqlbuild-analysis/src/graph/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ pub(crate) const TEST_KIND: &str = "test";
pub(crate) const JOB_KIND: &str = "job";
pub(crate) const NODE_KIND_KIND: &str = "kind";
/// The node kinds `kind:` selects, as the catalog names them: SQL resources, then Python nodes.
pub(crate) const SELECTABLE_NODE_KINDS: [&str; 10] = [
"model", "source", "seed", "udf", "table_fn", "function", "task", "asset", "loader", "check",
pub(crate) const SELECTABLE_NODE_KINDS: [&str; 9] = [
"model", "source", "seed", "udf", "table_fn", "function", "asset", "loader", "check",
];
/// `kind:function` selects both function kinds.
pub(crate) const FUNCTION_KIND_ALIAS: &str = "function";
/// Selector kinds Python parses but `sqb compile` cannot map to a compiled resource.
pub(crate) const UNMAPPED_KINDS: [&str; 4] = ["task", "asset", "loader", "check"];
pub(crate) const UNMAPPED_KINDS: [&str; 3] = ["asset", "loader", "check"];
pub(crate) const SUGGESTION_CUTOFF: f64 = 0.8;
pub(crate) const SUGGESTION_LIMIT: usize = 3;
pub(crate) const EMPTY_SELECTOR_CODE: &str = "S001";
Expand Down
6 changes: 3 additions & 3 deletions crates/sqlbuild-analysis/src/graph/tests/test_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ fn given_invalid_selectors_when_resolving_then_errors_match_python() {
),
},
SelectorErrorTestCase {
description: "task:abc",
select: &["task:abc"],
description: "asset:abc",
select: &["asset:abc"],
exclude: &[],
expected_error: (
"S010",
"selector type 'task' does not map to a resource type yet",
"selector type 'asset' does not map to a resource type yet",
None,
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ fn given_a_selection_when_listing_named_atoms_then_only_single_node_names_count(
},
NamedAtomsTestCase {
description: "typed names count",
selection: "task:refund_review source:raw_orders seed:countries test:orders_unique",
selection: "asset:refund_review source:raw_orders seed:countries test:orders_unique",
expected_atoms: &[
"task:refund_review",
"asset:refund_review",
"source:raw_orders",
"seed:countries",
"test:orders_unique",
Expand All @@ -31,7 +31,7 @@ fn given_a_selection_when_listing_named_atoms_then_only_single_node_names_count(
},
NamedAtomsTestCase {
description: "kinds do not count",
selection: "kind:model kind:task",
selection: "kind:model kind:asset",
expected_atoms: &[],
},
NamedAtomsTestCase {
Expand All @@ -46,7 +46,7 @@ fn given_a_selection_when_listing_named_atoms_then_only_single_node_names_count(
},
NamedAtomsTestCase {
description: "globs do not count",
selection: "fct_orders_* task:refund_? fct_[ab]",
selection: "fct_orders_* asset:refund_? fct_[ab]",
expected_atoms: &[],
},
NamedAtomsTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ fn given_raw_selector_when_parsing_then_returns_kind_value_and_expansion() {
raw: "+seed:country_codes",
expected_selector: kind("seed", "country_codes", true, false),
},
ParseSelectorTestCase {
description: "task typed selector",
raw: "task:prepare_orders",
expected_selector: kind("task", "prepare_orders", false, false),
},
ParseSelectorTestCase {
description: "asset typed selector",
raw: "asset:export_orders",
Expand Down Expand Up @@ -553,10 +548,10 @@ fn given_unresolvable_selectors_when_resolving_then_fails_with_message() {
ProjectSelectorErrorTestCase {
description: "a Python node kind needs the Python node graph",
project: DIAMOND_PROJECT,
select: &["kind:task"],
select: &["kind:asset"],
expected_error: (
"S010",
"selector 'kind:task' selects Python nodes; they cannot be selected here",
"selector 'kind:asset' selects Python nodes; they cannot be selected here",
None,
),
},
Expand Down
Loading
Loading