:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(warehouse): align groups backfill with full persons imports (#118805)
Eric Duongb6ee6b8a619b
diff --git a/docs/internal/hogql-trino-compiler.md b/docs/internal/hogql-trino-compiler.mdindex 2c9a7fc6a5eb..a218952758bf 100644--- a/docs/internal/hogql-trino-compiler.md+++ b/docs/internal/hogql-trino-compiler.md@@ -205,12 +205,14 @@ Starting the sensor discovers all eligible teams, including existing membershipsThe table name is `posthog.groups_<schema_name>`, derived from the control-plane team membership, including teams with grandfathered events or persons table names.Legacy teams without a membership use `posthog.groups` for manual runs.-The export keeps the latest row per `(team_id, group_type_index, group_key)` using `_timestamp` and `_offset`.-The export sorts rows by group type and key for Parquet encoding and pruning.-A successful registration replaces the team's snapshot in one transaction, including clearing old rows when the source is empty.-A generation reserved before export is committed with the rows in the table's `posthog_groups_backfill:` comment. Older exports are rejected after a newer snapshot commits, and a new epoch fences exports from before a table reset.+The export reads `groups FINAL` without an explicit sort; deduplication follows the ClickHouse table engine.+Like the full persons job, it deletes the team's existing rows before exporting and repeats the delete immediately before registering the run's files.+Connection retries replay that delete-and-register unit to avoid duplicate rows when a registration commits without an acknowledgement.+An empty export clears the team's rows. A failed export or registration can leave an empty or partial team until a retry succeeds.+Registration uses autocommit and does not use generation markers or table comments.+Avoid overlapping manual runs for the same team because an older export can replace newer data.+Setting `cleanup_existing_partition_data: false` appends files instead and disables replay deduplication, matching persons.The legacy shared `groups` table cannot be dropped with `delete_tables`.-Failed exports leave the previous snapshot in place.Dry runs and S3-only exports are tagged as previews and do not mark the warehouse groups snapshot complete or hide prior snapshot history. Active runs are checked separately.Backfill lifecycle and metrics are recorded with dataset `groups`; the warehouse status UI continues to report events, persons, and sources.diff --git a/posthog/dags/README_DUCKLINGS.md b/posthog/dags/README_DUCKLINGS.mdindex 8ced539d465b..edd41b21c508 100644--- a/posthog/dags/README_DUCKLINGS.md+++ b/posthog/dags/README_DUCKLINGS.md@@ -50,20 +50,21 @@ Rerun a team partition manually to refresh its groups; there is no daily groupsEach sensor tick checks at most 25 teams, schedules at most three runs, and advances a cursor so repeated failures cannot block discovery.Failed snapshots retry with exponential backoff from 10 minutes to a maximum of 320 minutes.The sensor checks active runs separately from real snapshot history; previews do not hide a successful or active snapshot.-The export reads ClickHouse groups with `FINAL` and replaces the team's DuckLake snapshot in a transaction.+The export reads ClickHouse groups with `FINAL` and follows the full persons delete-and-register flow.Deduplication follows the table engine: the highest `_timestamp` wins, with equal timestamps resolved by insertion order.The export does not apply an explicit sort.-Before exporting, the job reserves a generation in the table comment. Registration commits that generation with the rows, so an older export cannot overwrite a newer snapshot, including an empty one.-A table reset starts a new generation epoch. The `posthog_groups_backfill:` table comment is reserved for snapshot state; do not edit it manually.-Output metadata reports `superseded: true` when a newer snapshot or table reset prevents registration.+With the default `cleanup_existing_partition_data: true`, the job deletes the team's rows before export.+Immediately before registering files, it deletes the team's rows again; reconnect retries replay that delete-and-register unit to avoid duplicate rows.+Registration uses autocommit, matching persons; failures can leave an empty or partially registered team until a retry succeeds.+There is no generation marker or table-comment dependency. Avoid overlapping manual runs for the same team because an older export can replace newer data.`delete_tables` is refused for the legacy shared `groups` table.-The job shares the events/persons backfill concurrency limit and supports `dry_run` and `skip_ducklake_registration`.-Groups snapshots require `cleanup_existing_partition_data: true`.+The job supports `dry_run` and `skip_ducklake_registration`.+As with persons, setting `cleanup_existing_partition_data: false` appends files instead of replacing rows and disables replay deduplication.Groups exports default to a 100 GiB query memory limit, matching full persons exports.Override it with `clickhouse_settings.max_memory_usage` when launching a run.For a memory failure, lower `max_s3_file_fanout` and rerun the same team partition with `delete_tables: false`.-A failed export does not replace the previous snapshot; only a successful export proceeds to registration.+A failed export leaves the team empty when cleanup is enabled; only a successful export proceeds to registration.The groups sensor defaults to stopped. Use a manual snapshot to validate rollout before enabling automatic discovery:diff --git a/products/managed_warehouse/backend/tests/test_groups_backfill.py b/products/managed_warehouse/backend/tests/test_groups_backfill.pyindex aeda864aa4fc..916bcd0b6e37 100644--- a/products/managed_warehouse/backend/tests/test_groups_backfill.py+++ b/products/managed_warehouse/backend/tests/test_groups_backfill.py@@ -1,7 +1,6 @@from __future__ import annotationsfrom collections.abc import Iterator-from contextlib import contextmanagerfrom datetime import UTC, datetime, timedeltafrom pathlib import Pathfrom typing import cast@@ -35,8 +34,7 @@ from products.managed_warehouse.dags.groups_backfill import (ensure_groups_table,export_groups_to_duckling_s3,groups_snapshot_select_sql,- replace_groups_snapshot,- reserve_groups_snapshot,+ run_groups_backfill,)@@ -127,16 +125,8 @@ class _LakeConnection:def __exit__(self, *args: object) -> None:pass- @contextmanager- def transaction(self) -> Iterator[None]:- self.connection.execute("BEGIN")- try:- yield- except BaseException:- self.connection.execute("ROLLBACK")- raise- else:- self.connection.execute("COMMIT")+ def close(self) -> None:+ pass@pytest.fixture@@ -153,49 +143,107 @@ def lake(tmp_path: Path) -> Iterator[psycopg.Connection[tuple[object, ...]]]:connection.close()[email protected]("invalid_file", [False, True])-def test_groups_snapshot_replacement_is_replayable_and_rolls_back_failed_registration(- lake: psycopg.Connection[tuple[object, ...]], tmp_path: Path, invalid_file: bool+ "scenario",+ [+ "success",+ "partial_disconnect",+ "committed_disconnect",+ "invalid_file",+ "export_failure",+ "empty",+ "append",+ "dry_run",+ "skip_registration",+ ],+)+def test_groups_full_backfill_cleans_team_and_replays_registration(+ lake: psycopg.Connection[tuple[object, ...]], tmp_path: Path, scenario: str) -> None:table = f"{DUCKLAKE_ALIAS}.posthog.groups_production"target = DucklingTarget(team_id=7, organization_id="org", bucket="unused", bucket_region="us-east-1")lake.execute(f"INSERT INTO {table} (team_id, group_type_index, group_key) VALUES (7, 0, 'old'), (8, 0, 'other')")- lake.execute(- f"COPY (SELECT * REPLACE ('new' AS group_key) FROM {table} WHERE team_id = 7) TO %s (FORMAT PARQUET)",- (str(tmp_path / "a.parquet"),),- )- ticket = reserve_groups_snapshot(lake, "groups_production")- if invalid_file:+ for name in ("a", "b"):+ lake.execute(+ f"COPY (SELECT * REPLACE ('{name}' AS group_key) FROM {table} WHERE team_id = 7) TO %s (FORMAT PARQUET)",+ (str(tmp_path / f"{name}.parquet"),),+ )+ valid_second_file = (tmp_path / "b.parquet").read_bytes()+ if scenario == "invalid_file":(tmp_path / "b.parquet").write_bytes(b"invalid parquet")- with pytest.raises(duckdb.Error):- replace_groups_snapshot(lake, target, "groups_production", str(tmp_path / "*.parquet"), ticket)- assert lake.execute(f"SELECT team_id, group_key FROM {table} ORDER BY team_id").fetchall() == [- (7, "old"),- (8, "other"),- ]- else:- for _ in range(2):+ config = DucklingBackfillConfig(+ cleanup_existing_partition_data=scenario != "append",+ dry_run=scenario == "dry_run",+ skip_ducklake_registration=scenario == "skip_registration",+ )+ context = MagicMock()+ context.partition_key = "7"+ context.run.run_id = "synthetic-run"+ cluster = MagicMock()+ preview = config.dry_run or config.skip_ducklake_registration+ adapter = cast(_LakeConnection, cast(object, lake))+ execute = adapter.execute+ registrations = 0+ failing_export = scenario == "export_failure"++ def export_result(**kwargs: object) -> MagicMock:+ if not preview and config.cleanup_existing_partition_data:+ assert lake.execute(f"SELECT group_key FROM {table} WHERE team_id = 7").fetchall() == []+ if failing_export:+ raise RuntimeError("export failed")+ result = MagicMock()+ result.result.return_value = (+ None if config.dry_run else str(tmp_path / ("empty-*.parquet" if scenario == "empty" else "*.parquet"))+ )+ return result++ def execute_with_disconnect(+ query: str | sql.Composable, params: tuple[object, ...] | None = None+ ) -> _LakeConnection:+ nonlocal registrations+ result = execute(query, params)+ if isinstance(query, str) and query.startswith("CALL ducklake_add_data_files"):+ registrations += 1+ if (scenario == "partial_disconnect" and registrations == 1) or (+ scenario == "committed_disconnect" and registrations == 2+ ):+ raise psycopg.OperationalError("server closed the connection unexpectedly")+ return result++ cluster.any_host_by_role.side_effect = export_result+ with (+ patch("products.managed_warehouse.dags.groups_backfill._resolve_duckling_target", return_value=target),+ patch("products.managed_warehouse.dags.groups_backfill.resolve_groups_table", return_value="groups_production"),+ patch("products.managed_warehouse.dags.groups_backfill._get_cluster", return_value=cluster),+ patch("products.managed_warehouse.dags.groups_backfill.record_duckling_backfill_workload"),+ patch("posthog.dags.events_backfill_to_duckling._mint_backfill_service_credential", return_value=None),+ patch("posthog.dags.events_backfill_to_duckling._connect_duckgres", return_value=lake) as connect,+ patch("posthog.dags.events_backfill_to_duckling.time.sleep"),+ patch.object(adapter, "execute", side_effect=execute_with_disconnect),+ ):+ if scenario in ("invalid_file", "export_failure"):+ with pytest.raises(duckdb.Error if scenario == "invalid_file" else RuntimeError):+ run_groups_backfill(context, config)+ expected = [(7, "a"), (8, "other")] if scenario == "invalid_file" else [(8, "other")]assert (- replace_groups_snapshot(- lake, target, "groups_production", str(tmp_path / "*.parquet"), ticket- ).files_registered- == 1+ lake.execute(f"SELECT team_id, group_key FROM {table} ORDER BY team_id, group_key").fetchall()+ == expected)- assert lake.execute(f"SELECT team_id, group_key FROM {table} ORDER BY team_id").fetchall() == [- (7, "new"),- (8, "other"),- ]- empty_ticket = reserve_groups_snapshot(lake, "groups_production")- assert (- replace_groups_snapshot(- lake, target, "groups_production", str(tmp_path / "empty-*.parquet"), empty_ticket- ).files_registered- == 0- )- assert replace_groups_snapshot(- lake, target, "groups_production", str(tmp_path / "*.parquet"), ticket- ).superseded- assert lake.execute(f"SELECT team_id, group_key FROM {table}").fetchall() == [(8, "other")]+ (tmp_path / "b.parquet").write_bytes(valid_second_file)+ failing_export = False+ run_groups_backfill(context, config)+ assert bool(connect.call_count) is not preview++ expected_rows = [(8, "other")]+ if scenario not in ("empty", "dry_run", "skip_registration"):+ expected_rows.extend([(7, "a"), (7, "b")])+ if scenario in ("append", "dry_run", "skip_registration"):+ expected_rows.append((7, "old"))+ assert lake.execute(f"SELECT team_id, group_key FROM {table} ORDER BY team_id, group_key").fetchall() == sorted(+ expected_rows+ )+ expected_files = 0 if scenario in ("empty", "dry_run", "skip_registration") else 2+ assert context.add_output_metadata.call_args.args[0]["files_registered"] == expected_files_NOW = datetime(2026, 1, 1, tzinfo=UTC)@@ -360,46 +408,6 @@ def test_preview_clears_inherited_snapshot_tag(config: dict[str, bool]) -> None:assert run.tags[GROUPS_SNAPSHOT_TAG] == "false"-def test_older_snapshot_cannot_overwrite_a_newer_snapshot(- lake: psycopg.Connection[tuple[object, ...]], tmp_path: Path-) -> None:- table = f"{DUCKLAKE_ALIAS}.posthog.groups_production"- target = DucklingTarget(team_id=7, organization_id="org", bucket="unused", bucket_region="us-east-1")- lake.execute(f"INSERT INTO {table} (team_id, group_type_index, group_key) VALUES (7, 0, 'initial')")- lake.execute(- f"COPY (SELECT * REPLACE ('old' AS group_key) FROM {table}) TO %s (FORMAT PARQUET)",- (str(tmp_path / "old.parquet"),),- )- lake.execute(- f"COPY (SELECT * REPLACE ('new' AS group_key) FROM {table}) TO %s (FORMAT PARQUET)",- (str(tmp_path / "new.parquet"),),- )- old = reserve_groups_snapshot(lake, "groups_production")- new = reserve_groups_snapshot(lake, "groups_production")- adapter = cast(_LakeConnection, cast(object, lake))- competing = cast(psycopg.Connection[tuple[object, ...]], _LakeConnection(adapter.connection.cursor()))- execute = adapter.execute- interleaved = False-- def commit_newer_before_older_marker(- query: str | sql.Composable, params: tuple[object, ...] | None = None- ) -> _LakeConnection:- nonlocal interleaved- if isinstance(query, sql.Composable) and query.as_string().startswith("COMMENT ON TABLE") and not interleaved:- interleaved = True- replace_groups_snapshot(competing, target, "groups_production", str(tmp_path / "new.parquet"), new)- return execute(query, params)-- with patch.object(adapter, "execute", side_effect=commit_newer_before_older_marker):- assert replace_groups_snapshot(lake, target, "groups_production", str(tmp_path / "old.parquet"), old).superseded- assert interleaved- assert lake.execute(f"SELECT group_key FROM {table}").fetchall() == [("new",)]- ensure_groups_table(lake, "groups_production", DucklingBackfillConfig(delete_tables=True))- reset = reserve_groups_snapshot(lake, "groups_production")- assert reset.epoch != old.epoch- assert replace_groups_snapshot(lake, target, "groups_production", str(tmp_path / "old.parquet"), old).superseded--def test_delete_tables_refuses_legacy_shared_table(lake: psycopg.Connection[tuple[object, ...]]) -> None:with pytest.raises(ValueError, match="shared groups table"):ensure_groups_table(lake, "groups", DucklingBackfillConfig(delete_tables=True))diff --git a/products/managed_warehouse/dags/groups_backfill.py b/products/managed_warehouse/dags/groups_backfill.pyindex 60ddf6a22044..67798e0df79a 100644--- a/products/managed_warehouse/dags/groups_backfill.py+++ b/products/managed_warehouse/dags/groups_backfill.py@@ -1,7 +1,4 @@-import json-from dataclasses import replacefrom typing import TYPE_CHECKING-from uuid import uuid4from django.utils import timezone@@ -20,7 +17,6 @@ from dagster import (sensor,)from psycopg import sql-from tenacity import retry, retry_if_exception, stop_after_attempt, wait_random_exponentialfrom posthog.hogql.escape_sql import escape_clickhouse_string@@ -38,13 +34,13 @@ from posthog.dags.events_backfill_to_duckling import (DucklingTarget,_compute_fanout,_DuckgresSession,+ _execute_export_with_retry,_get_cluster,_glob_run_files,_repair_stale_running_statuses,_resolve_duckling_target,get_s3_url_for_clickhouse,)-from posthog.dataclasses import frozenfrom products.data_warehouse.backend.facade.backfill_status import record_backfill_finished, record_backfill_startedfrom products.data_warehouse.backend.facade.models import ManagedWarehouseBackfillPartition@@ -64,7 +60,6 @@ MAX_TEAMS_PER_TICK = 25MAX_RUN_REQUESTS_PER_TICK = 3RETRY_HISTORY_LIMIT = 6RETRY_BASE_SECONDS = 600-STATE_COMMENT_PREFIX = "posthog_groups_backfill:"GROUPS_TAGS = {"owner": JobOwners.TEAM_MANAGED_WAREHOUSE.value, **DUCKLING_BACKFILL_CONCURRENCY_TAG}duckling_groups_partitions_def = DynamicPartitionsDefinition(name="duckling_groups_backfill")GROUPS_COLUMN_TYPES = {@@ -122,7 +117,7 @@ def export_groups_to_duckling_s3(SETTINGS s3_truncate_on_insert=1, use_hive_partitioning=0"""# A failed export can leave partial S3 objects; only register files after the whole query succeeds.- client.execute(export_sql, settings=settings)+ _execute_export_with_retry(client, export_sql, settings, f"team_id={target.team_id}, full groups export")return s3_glob@@ -148,134 +143,48 @@ def ensure_groups_table(raise ValueError(f"Groups table schema mismatch: expected {GROUPS_COLUMN_TYPES}, got {actual}")-@frozen-class GroupsSnapshotTicket:- epoch: str- generation: int---@frozen-class GroupsSnapshotRegistration:- files_registered: int- superseded: bool = False---@frozen-class _GroupsSnapshotState:- epoch: str- issued: int- applied: dict[str, int]---def _read_snapshot_state(conn: psycopg.Connection[tuple[object, ...]], table_name: str) -> _GroupsSnapshotState:- rows = conn.execute(- "SELECT comment FROM duckdb_tables() WHERE database_name = %s AND schema_name = 'posthog' AND table_name = %s",- (DUCKLAKE_ALIAS, table_name),- ).fetchall()- if len(rows) != 1:- raise ValueError("Groups table is missing from the catalog")- comment = rows[0][0]- if comment is None:- return _GroupsSnapshotState(epoch=uuid4().hex, issued=0, applied={})- if not isinstance(comment, str) or not comment.startswith(STATE_COMMENT_PREFIX):- raise ValueError("Groups table has unexpected snapshot metadata")- payload = json.loads(comment[len(STATE_COMMENT_PREFIX) :])- if not isinstance(payload, dict):- raise ValueError("Invalid groups snapshot metadata")- epoch, issued, applied = payload.get("epoch"), payload.get("issued"), payload.get("applied")- if not isinstance(epoch, str) or type(issued) is not int or issued < 0 or not isinstance(applied, dict):- raise ValueError("Invalid groups snapshot metadata")- if any(not isinstance(k, str) or type(v) is not int or not 0 <= v <= issued for k, v in applied.items()):- raise ValueError("Invalid groups snapshot generations")- return _GroupsSnapshotState(epoch=epoch, issued=issued, applied=applied)---def _write_snapshot_state(- conn: psycopg.Connection[tuple[object, ...]], table_name: str, state: _GroupsSnapshotState+def delete_groups_partition_data(+ conn: psycopg.Connection[tuple[object, ...]], target: DucklingTarget, table_name: str) -> None:- comment = STATE_COMMENT_PREFIX + json.dumps(- {"epoch": state.epoch, "issued": state.issued, "applied": state.applied}- )conn.execute(- sql.SQL("COMMENT ON TABLE {} IS {}").format(- sql.Identifier(DUCKLAKE_ALIAS, "posthog", table_name), sql.Literal(comment)- )+ sql.SQL("DELETE FROM {} WHERE team_id = %s").format(sql.Identifier(DUCKLAKE_ALIAS, "posthog", table_name)),+ (target.team_id,),)-def _transaction_conflict(error: BaseException) -> bool:- return "transaction conflict" in str(error).lower()---@retry(- retry=retry_if_exception(_transaction_conflict),- stop=stop_after_attempt(4),- wait=wait_random_exponential(multiplier=0.1, max=1),- reraise=True,-)-def reserve_groups_snapshot(conn: psycopg.Connection[tuple[object, ...]], table_name: str) -> GroupsSnapshotTicket:- with conn.transaction():- state = _read_snapshot_state(conn, table_name)- state = replace(state, issued=state.issued + 1)- _write_snapshot_state(conn, table_name, state)- return GroupsSnapshotTicket(epoch=state.epoch, generation=state.issued)---@retry(- retry=retry_if_exception(_transaction_conflict),- stop=stop_after_attempt(4),- wait=wait_random_exponential(multiplier=0.1, max=1),- reraise=True,-)-def replace_groups_snapshot(+def register_groups_files_with_duckling(+ context: AssetExecutionContext,conn: psycopg.Connection[tuple[object, ...]],- target: DucklingTarget,table_name: str,s3_glob: str,- ticket: GroupsSnapshotTicket,-) -> GroupsSnapshotRegistration:+) -> int:files = _glob_run_files(conn, s3_glob)- # The generation marker commits with the data, so disconnects and empty snapshots preserve ordering.- with conn.transaction():- state = _read_snapshot_state(conn, table_name)- applied = state.applied.get(str(target.team_id), 0)- if ticket.epoch != state.epoch or ticket.generation < applied:- return GroupsSnapshotRegistration(files_registered=0, superseded=True)- if ticket.generation == applied:- return GroupsSnapshotRegistration(files_registered=len(files))- if ticket.generation > state.issued:- raise ValueError("Groups snapshot generation was not reserved")+ if not files:+ context.log.info(f"No groups files produced for {s3_glob}, nothing to register")+ return 0+ context.log.info(f"Registering {len(files)} groups file(s) with DuckLake from {s3_glob}")+ for path in files:conn.execute(- sql.SQL("DELETE FROM {} WHERE team_id = %s").format(sql.Identifier(DUCKLAKE_ALIAS, "posthog", table_name)),- (target.team_id,),+ "CALL ducklake_add_data_files(%s, %s, %s, schema => 'posthog', allow_missing => true)",+ (DUCKLAKE_ALIAS, table_name, path),)- for path in files:- conn.execute(- "CALL ducklake_add_data_files(%s, %s, %s, schema => 'posthog', allow_missing => true)",- (DUCKLAKE_ALIAS, table_name, path),- )- _write_snapshot_state(- conn, table_name, replace(state, applied={**state.applied, str(target.team_id): ticket.generation})- )- return GroupsSnapshotRegistration(files_registered=len(files))+ return len(files)def run_groups_backfill(context: AssetExecutionContext, config: DucklingBackfillConfig) -> None:team_id = int(context.partition_key)groups_snapshot_select_sql(team_id)- if not config.cleanup_existing_partition_data:- raise ValueError("Groups snapshots require cleanup_existing_partition_data=True")target = _resolve_duckling_target(team_id)table_name = resolve_groups_table(team_id)tags = dagster_tags(context)- session = None- registration = GroupsSnapshotRegistration(files_registered=0)+ should_use_duckgres = not (config.dry_run or config.skip_ducklake_registration)+ session = _DuckgresSession(context, target) if should_use_duckgres else None+ files_registered = 0try:- ticket = None- if not (config.dry_run or config.skip_ducklake_registration):- session = _DuckgresSession(context, target)+ if session is not None:session.run("ensure groups table", lambda conn: ensure_groups_table(conn, table_name, config))- ticket = session.run("reserve groups snapshot", lambda conn: reserve_groups_snapshot(conn, table_name))+ if config.cleanup_existing_partition_data:+ session.run("delete all groups", lambda conn: delete_groups_partition_data(conn, target, table_name))def export(client: "Client") -> str | None:with tags_context(kind="dagster", dagster=tags):@@ -288,11 +197,15 @@ def run_groups_backfill(context: AssetExecutionContext, config: DucklingBackfill).result())- if s3_glob is not None and session is not None and ticket is not None:- registration = session.run(- "replace groups snapshot",- lambda conn: replace_groups_snapshot(conn, target, table_name, s3_glob, ticket),- )+ if s3_glob is not None and session is not None:++ def register_full_groups_files(conn: psycopg.Connection[tuple[object, ...]], glob: str = s3_glob) -> int:+ # Re-clear the team on replay because an unacknowledged registration may have committed.+ if config.cleanup_existing_partition_data:+ delete_groups_partition_data(conn, target, table_name)+ return register_groups_files_with_duckling(context, conn, table_name, glob)++ files_registered = session.run("register groups files (full)", register_full_groups_files)finally:if session is not None:session.close()@@ -300,16 +213,15 @@ def run_groups_backfill(context: AssetExecutionContext, config: DucklingBackfill{"team_id": team_id,"groups_table": table_name,- "files_registered": registration.files_registered,- "superseded": registration.superseded,+ "files_registered": files_registered,})- if not config.dry_run and not config.skip_ducklake_registration and not registration.superseded:+ if not config.dry_run and not config.skip_ducklake_registration:record_duckling_backfill_workload(team_id=team_id,dataset=GROUPS_DATASET,mode="full",- files_registered=registration.files_registered,+ files_registered=files_registered,partitions_exported=1,)