@@ -9,13 +9,13 @@ The streaming utility handles streaming data from AWS for processing data sets b
9
9
10
10
* Simple interface to stream data from S3, even when the data is larger than memory
11
11
* Read your S3 file using the patterns you already know to deal with files in Python
12
- * Includes common transformations to data stored in S3, like Gzip and Json deserialization
12
+ * Includes common transformations to data stored in S3, like Gzip and CSV deserialization
13
13
* Build your own data transformation and add it to the pipeline
14
14
15
15
## Background
16
16
17
17
Processing S3 files inside your Lambda function presents challenges when the file is bigger than the allocated
18
- amount of memory. Your data may also be stored using a set of encapsulation layers (gzip, JSON strings , etc).
18
+ amount of memory. Your data may also be stored using a set of encapsulation layers (gzip, CSV, zip files , etc).
19
19
20
20
This utility makes it easy to process data coming from S3 files, while applying data transformations transparently
21
21
to the data stream.
@@ -87,14 +87,20 @@ For instance, if you want to unzip an S3 file compressed using `LZMA` you could
87
87
-- 8 < -- " examples/streaming/src/s3_transform_lzma.py"
88
88
```
89
89
90
+ Or, if you want to load a ` TSV ` file, you can just change the delimiter on the ` CSV ` transform:
91
+
92
+ ``` python hl_lines="12"
93
+ -- 8 < -- " examples/streaming/src/s3_transform_tsv.py"
94
+ ```
95
+
90
96
### Building your own data transformation
91
97
92
98
You can build your own custom data transformation by extending the ` BaseTransform ` class.
93
- The ` transform ` method receives an ` io.RawIOBase ` object, and you are responsible for returning an object that is also
94
- a ` io.RawIOBase ` .
99
+ The ` transform ` method receives an ` IO[bytes] ` object, and you are responsible for returning an object that is also
100
+ a ` IO[bytes] ` .
95
101
96
102
``` python hl_lines="9 37 38"
97
- -- 8 < -- " aws_lambda_powertools/utilities/ streaming/transformations/json .py"
103
+ -- 8 < -- " examples/ streaming/src/s3_json_transform .py"
98
104
```
99
105
100
106
## Testing your code
0 commit comments