Skip to content

Commit f58f55b

Browse files
fix: DQ enhancements
1 parent 054a3b4 commit f58f55b

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

dagster/src/hooks/school_master.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,26 @@ def school_dq_checks_location_db_update_hook(context: HookContext):
1616
context.log.info("Running database update hook for DQ checks location...")
1717
config = FileConfig(**context.op_config)
1818

19+
# Get DQ mode from the file metadata to determine the correct status.
20+
# The mode flows in via the metadata JSON updated by the API (`dq_run` endpoint).
21+
dq_mode = (config.metadata or {}).get("dq_mode", "master")
22+
23+
# Map DQ mode to DQ status:
24+
# - "uploaded" -> FILE_CHECKED (initial uploaded-file check; awaiting master submit)
25+
# - "master" -> COMPLETED (full master-data validation finished)
26+
if dq_mode == "uploaded":
27+
dq_status = DQStatusEnum.FILE_CHECKED
28+
else:
29+
dq_status = DQStatusEnum.COMPLETED
30+
1931
with get_db_context() as db:
2032
db.execute(
2133
update(FileUpload)
2234
.where(FileUpload.id == config.filename_components.id)
2335
.values(
2436
{
2537
FileUpload.dq_report_path: str(config.destination_filepath_object),
26-
FileUpload.dq_status: DQStatusEnum.COMPLETED,
38+
FileUpload.dq_status: dq_status,
2739
},
2840
),
2941
)

0 commit comments

Comments
 (0)