Skip to content

Commit d1f5d56

Browse files
committed
Fix xml example
1 parent 933b6cb commit d1f5d56

File tree

1 file changed

+4
-6
lines changed
  • docs/website/docs/dlt-ecosystem/verified-sources/filesystem

1 file changed

+4
-6
lines changed

docs/website/docs/dlt-ecosystem/verified-sources/filesystem/advanced.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ BUCKET_URL = "s3://my_bucket/data"
111111

112112
# Define a standalone transformer to read data from an XML file.
113113
@dlt.transformer(standalone=True)
114-
def read_excel(
115-
items: Iterator[FileItemDict], sheet_name: str
116-
) -> Iterator[TDataItems]:
114+
def read_xml(items: Iterator[FileItemDict]) -> Iterator[TDataItems]:
117115
# Import the required xmltodict library.
118116
import xmltodict
119117

@@ -125,13 +123,13 @@ def read_excel(
125123
yield xmltodict.parse(file.read())
126124

127125
# Set up the pipeline to fetch a specific XML file from a filesystem (bucket).
128-
example_xls = filesystem(
126+
example_xml = filesystem(
129127
bucket_url=BUCKET_URL, file_glob="../directory/example.xml"
130-
) | read_excel("example_table") # Pass the data through the transformer to read the "example_table" sheet.
128+
) | read_xml() # Pass the data through the transformer
131129

132130
pipeline = dlt.pipeline(pipeline_name="my_pipeline", destination="duckdb", dataset_name="example_xml_data")
133131
# Execute the pipeline and load the extracted data into the "duckdb" destination.
134-
load_info = pipeline.run(example_xls.with_name("example_xml_data"))
132+
load_info = pipeline.run(example_xml.with_name("example_xml_data"))
135133

136134
# Print the loading information.
137135
print(load_info)

0 commit comments

Comments
 (0)