gfw.common.beam.pipeline.hooks#
Pipeline hooks for pre- or post-processing operations.
This module provides helper functions that generate hooks to be executed
during a pipeline’s lifecycle. Hooks are callable functions that take a
Pipeline object and perform arbitrary operations,
such as creating views, deleting data, or any other custom task.
Functions
Returns a hook function to create a BigQuery table. |
|
Returns a hook function to create a view of a BigQuery table. |
|
Returns a hook function to delete events from a BigQuery table. |
- create_view_hook(table_config, mock=False)[source]#
Returns a hook function to create a view of a BigQuery table.
- Parameters:
table_config (TableConfig) –
TableConfiginstance containing view details.mock (bool) – If True, uses a mocked BQ client instead of performing real operations.
- Returns:
A callable hook that accepts a
Pipelineinstance and creates the view.- Return type:
- delete_events_hook(table_config, start_date, end_date=None, mock=False)[source]#
Returns a hook function to delete events from a BigQuery table.
- Parameters:
table_config (TableConfig) –
TableConfigobject containing table detailsand delete query.start_date (date) – Date after which events should be deleted.
end_date (date | None) – Date up to which events should be deleted (exclusive).
mock (bool) – If True, uses a mocked BQ client instead of performing real operations.
- Returns:
A callable hook that accepts a
Pipelineinstance and deletes events.- Return type:
- create_table_hook(table_config, mock=False)[source]#
Returns a hook function to create a BigQuery table.
- Parameters:
table_config (TableConfig) –
TableConfiginstance containing view details.mock (bool) – If True, uses a mocked BQ client instead of performing real operations.
- Returns:
A callable hook that accepts a
Pipelineinstance and creates the view.- Return type: