Skip to content

Commit 3f8ab82

Browse files
sethusrinivasanigorborgest
authored andcommitted
FIX: Timestream sample in Readme
- datetime.now() requires importing datetime module - Query had non-existing dimensions, removed them and replaced with the "my_dimension" so that it matches with dimension mentioned in wr.timestream.write()
1 parent 977b61e commit 3f8ab82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Installation command: `pip install awswrangler`
3838
```py3
3939
import awswrangler as wr
4040
import pandas as pd
41+
import datetime
4142

4243
df = pd.DataFrame({"id": [1, 2], "value": ["foo", "boo"]})
4344

@@ -63,7 +64,7 @@ con.close()
6364

6465
# Amazon Timestream Write
6566
df = pd.DataFrame({
66-
"time": [datetime.now(), datetime.now()],
67+
"time": [datetime.datetime.now() , datetime.datetime.now() ],
6768
"my_dimension": ["foo", "boo"],
6869
"measure": [1.0, 1.1],
6970
})
@@ -77,7 +78,7 @@ rejected_records = wr.timestream.write(df,
7778

7879
# Amazon Timestream Query
7980
wr.timestream.query("""
80-
SELECT time, measure_value::double, dim0, dim1
81+
SELECT time, measure_value::double, my_dimension
8182
FROM "sampleDB"."sampleTable" ORDER BY time DESC LIMIT 3
8283
""")
8384

0 commit comments

Comments
 (0)