From 301d0a2c86dd8c86b1ba4183a010f2c985a11716 Mon Sep 17 00:00:00 2001 From: dat-a-man <98139823+dat-a-man@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:12:29 +0530 Subject: [PATCH] updated the documentation (#1784) * updted the documentation * Updated --- docs/website/docs/general-usage/incremental-loading.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/website/docs/general-usage/incremental-loading.md b/docs/website/docs/general-usage/incremental-loading.md index 5ff587f20e..1830db636f 100644 --- a/docs/website/docs/general-usage/incremental-loading.md +++ b/docs/website/docs/general-usage/incremental-loading.md @@ -1064,7 +1064,7 @@ def tweets(): data = get_data(start_from=last_val) yield data # change the state to the new value - dlt.current.state()["last_updated"] = data["last_timestamp"] + dlt.current.resource_state()["last_updated"] = data["last_timestamp"] ``` If we keep a list or a dictionary in the state, we can modify the underlying values in the objects, @@ -1140,7 +1140,7 @@ def search_tweets(twitter_bearer_token=dlt.secrets.value, search_terms=None, sta headers = _headers(twitter_bearer_token) for search_term in search_terms: # make cache for each term - last_value_cache = dlt.current.state().setdefault(f"last_value_{search_term}", None) + last_value_cache = dlt.current.resource_state().setdefault(f"last_value_{search_term}", None) print(f'last_value_cache: {last_value_cache}') params = {...} url = "https://api.twitter.com/2/tweets/search/recent" @@ -1149,7 +1149,7 @@ def search_tweets(twitter_bearer_token=dlt.secrets.value, search_terms=None, sta page['search_term'] = search_term last_id = page.get('meta', {}).get('newest_id', 0) #set it back - not needed if we - dlt.current.state()[f"last_value_{search_term}"] = max(last_value_cache or 0, int(last_id)) + dlt.current.resource_state()[f"last_value_{search_term}"] = max(last_value_cache or 0, int(last_id)) # print the value for each search term print(f'new_last_value_cache for term {search_term}: {last_value_cache}')