Skip to content

Commit 9498b50

Browse files
committed
Add Amazon Timestream to quickstart.
1 parent 0f8d51e commit 9498b50

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ df = wr.athena.read_sql_query("SELECT * FROM my_table", database="my_db")
6060
con = wr.redshift.connect("my-glue-connection")
6161
df = wr.redshift.read_sql_query("SELECT * FROM external_schema.my_table", con=con)
6262
con.close()
63+
64+
# Amazon Timestream Write
65+
df = pd.DataFrame(
66+
{
67+
"time": [datetime.now(), datetime.now(), datetime.now()],
68+
"dim0": ["foo", "boo", "bar"],
69+
"dim1": [1, 2, 3],
70+
"measure": [1.0, 1.1, 1.2],
71+
}
72+
)
73+
rejected_records = wr.timestream.write(
74+
df=df,
75+
database="sampleDB",
76+
table="sampleTable",
77+
time_col="time",
78+
measure_col="measure",
79+
dimensions_cols=["dim0", "dim1"],
80+
)
81+
82+
# Amazon Timestream Write
83+
wr.timestream.query("""
84+
SELECT
85+
time, measure_value::double, dim0, dim1
86+
FROM "sampleDB"."sampleTable"
87+
ORDER BY time DESC LIMIT 3
88+
""")
89+
6390
```
6491

6592
## [Read The Docs](https://aws-data-wrangler.readthedocs.io/)

docs/source/index.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,32 @@ Quick Start
3232
df = wr.redshift.read_sql_query("SELECT * FROM external_schema.my_table", con=con)
3333
con.close()
3434
35+
# Amazon Timestream Write
36+
df = pd.DataFrame(
37+
{
38+
"time": [datetime.now(), datetime.now(), datetime.now()],
39+
"dim0": ["foo", "boo", "bar"],
40+
"dim1": [1, 2, 3],
41+
"measure": [1.0, 1.1, 1.2],
42+
}
43+
)
44+
rejected_records = wr.timestream.write(
45+
df=df,
46+
database="sampleDB",
47+
table="sampleTable",
48+
time_col="time",
49+
measure_col="measure",
50+
dimensions_cols=["dim0", "dim1"],
51+
)
52+
53+
# Amazon Timestream Write
54+
wr.timestream.query("""
55+
SELECT
56+
time, measure_value::double, dim0, dim1
57+
FROM "sampleDB"."sampleTable"
58+
ORDER BY time DESC LIMIT 3
59+
""")
60+
3561
Read The Docs
3662
-------------
3763

0 commit comments

Comments
 (0)