ReportsTask — Developer Reference
Developer API usage and examples for ReportsTask.
Constructor Parameters
| Parameter | Type | Description |
|---|---|---|
name | Optional[str] | Custom name for the task |
job_context | JobContext | Context with Spark session and configuration |
database_sink | Optional[DatabaseSink] | Database sink to write report tables |
write_to_catalog | Optional[bool] | If True, write results to DB using DatabaseSink (default: False) |
is_incremental | Optional[bool] | If True, run tasks that support incremental logic in incremental mode (default: None) |
Incremental support
ReportsTask.requires_incremental() expects ProcessedAddedRoomModel. Subtasks that allow incremental logic will only regenerate affected rows. Use the is_incremental=True flag together with write_to_catalog=True to run incremental upserts (instead of full writes).
Note: ReportsTask forwards write_to_catalog and is_incremental to subtasks; pass them to the parent task to control persistence and incremental logic centrally.
Example Usage
from etl_lib.tasks.reports.ReportsTask import ReportsTask
task = ReportsTask(job_context=job_context, database_sink=sink)
task.run()Examples
Skip a single report (name without “Task”):
task = ReportsTask(job_context=job_context, database_sink=sink, skip_reports=['BookingRoomsReport'])
task.run()Run only specific reports and persist them:
task = ReportsTask(
job_context=job_context,
database_sink=sink,
only_run_reports=['DailyReport', 'GuestLoyaltyReport'],
write_to_catalog=True
)
task.run()Example: only run nightly and guest loyalty reports, write to DB
task = ReportsTask(
job_context=job_context,
database_sink=sink,
only_run_reports=['DailyReport','GuestLoyaltyReport'],
write_to_catalog=True
)
task.run()Subtask orchestration
The ReportsTask orchestrates all report subtasks, similar to ProcessingTask.
Back to the process documentation: /processes/tasks/reports/reports-task
Last updated on