Skip to content

Commit

Permalink
clean up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Sep 28, 2023
1 parent 84a83c1 commit 86b209f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/website/docs/examples/transformers/code/run-snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ async def pokemon(pokemon: TDataItem):
Yields:
dict: The pokemon full data.
"""
# just return the results, if you yield,
# just return the results, if you yield,
# generator will be evaluated in main thread
return requests.get(pokemon["url"]).json()


# asynchronously retrieve details for the species of each pokemon
@dlt.transformer(data_from=pokemon)
Expand All @@ -42,7 +42,7 @@ async def species(pokemon: TDataItem):
Yields:
dict: The species full data.
"""
# just return the results, if you yield,
# just return the results, if you yield,
# generator will be evaluated in main thread
species_data = requests.get(pokemon["species"]["url"]).json()
# optionally add pokemon_id to result json, to later be able
Expand All @@ -55,7 +55,7 @@ async def species(pokemon: TDataItem):
pipeline = dlt.pipeline(
pipeline_name="pokemon", destination="duckdb", dataset_name="pokemon_data"
)

# the pokemon_list resource does not need to be loaded
load_info = pipeline.run([pokemon(), species()])
print(load_info)
Expand Down

0 comments on commit 86b209f

Please sign in to comment.