diff --git a/docs/examples/transformers/pokemon.py b/docs/examples/transformers/pokemon.py index d1c8eb3689..75708fca03 100644 --- a/docs/examples/transformers/pokemon.py +++ b/docs/examples/transformers/pokemon.py @@ -52,11 +52,12 @@ def species(pokemon: TDataItem): def source(): return [pokemon_list | pokemon, pokemon_list | pokemon | species] -# build duck db pipeline -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(source()) -print(load_info) \ No newline at end of file +if __name__ == "__main__": + # build duck db pipeline + 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(source()) + print(load_info) \ No newline at end of file diff --git a/docs/website/docs/examples/incremental_loading/code/zendesk-snippets.py b/docs/website/docs/examples/incremental_loading/code/zendesk-snippets.py index 86914fdb4f..a6170d51bf 100644 --- a/docs/website/docs/examples/incremental_loading/code/zendesk-snippets.py +++ b/docs/website/docs/examples/incremental_loading/code/zendesk-snippets.py @@ -120,13 +120,15 @@ def get_pages( # @@@DLT_SNIPPET_START markdown_pipeline - # create dlt pipeline - pipeline = dlt.pipeline( - pipeline_name="zendesk", destination="duckdb", dataset_name="zendesk_data" - ) - - load_info = pipeline.run(zendesk_support()) - print(load_info) + __name__ = "__main__" # @@@DLT_REMOVE + if __name__ == "__main__": + # create dlt pipeline + pipeline = dlt.pipeline( + pipeline_name="zendesk", destination="duckdb", dataset_name="zendesk_data" + ) + + load_info = pipeline.run(zendesk_support()) + print(load_info) # @@@DLT_SNIPPET_END markdown_pipeline # @@@DLT_SNIPPET_END example diff --git a/docs/website/docs/examples/transformers/code/pokemon-snippets.py b/docs/website/docs/examples/transformers/code/pokemon-snippets.py index ac3504c2b6..3fd73d480c 100644 --- a/docs/website/docs/examples/transformers/code/pokemon-snippets.py +++ b/docs/website/docs/examples/transformers/code/pokemon-snippets.py @@ -56,14 +56,16 @@ def species(pokemon: TDataItem): def source(): return [pokemon_list | pokemon, pokemon_list | pokemon | species] - # build duck db pipeline - pipeline = dlt.pipeline( - pipeline_name="pokemon", destination="duckdb", dataset_name="pokemon_data" - ) + __name__ = "__main__" # @@@DLT_REMOVE + if __name__ == "__main__": + # build duck db pipeline + 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(source()) - print(load_info) + # the pokemon_list resource does not need to be loaded + load_info = pipeline.run(source()) + print(load_info) # @@@DLT_SNIPPET_END example # test assertions diff --git a/docs/website/docs/examples/transformers/index.md b/docs/website/docs/examples/transformers/index.md index eb60f45421..92a5a2631b 100644 --- a/docs/website/docs/examples/transformers/index.md +++ b/docs/website/docs/examples/transformers/index.md @@ -81,14 +81,15 @@ def species(pokemon: TDataItem): def source(): return [pokemon_list | pokemon, pokemon_list | pokemon | species] -# build duck db pipeline -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(source()) -print(load_info) +if __name__ == "__main__": + # build duck db pipeline + 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(source()) + print(load_info) ```