Troubleshooting incremental loading
If you see that the incremental loading is not working as expected and the incremental values are not modified between pipeline runs, check the following:
-
Make sure the
destination
,pipeline_name
, anddataset_name
are the same between pipeline runs. -
Check if
dev_mode
isFalse
in the pipeline configuration. Check ifrefresh
for associated sources and resources is not enabled. -
Check the logs for the
Bind incremental on <resource_name> ...
message. This message indicates that the incremental value was bound to the resource and shows the state of the incremental value. -
After the pipeline run, check the state of the pipeline. You can do this by running the following command:
dlt pipeline -v <pipeline_name> info
For example, if your pipeline is defined as follows:
@dlt.resource
def my_resource(
incremental_object = dlt.sources.incremental("some_key", initial_value=0),
):
...
pipeline = dlt.pipeline(
pipeline_name="example_pipeline",
destination="duckdb",
)
pipeline.run(my_resource)
You'll see the following output:
Attaching to pipeline <pipeline_name>
...
sources:
{
"example": {
"resources": {
"my_resource": {
"incremental": {
"some_key": {
"initial_value": 0,
"last_value": 42,
"unique_hashes": [
"nmbInLyII4wDF5zpBovL"
]
}
}
}
}
}
}
Verify that the last_value
is updated between pipeline runs.