Commit e87269b9 authored by Patrick Godwin's avatar Patrick Godwin

update README with usage for storing data in column form

parent 3145645d
Pipeline #51971 passed with stages
in 36 seconds
......@@ -51,6 +51,8 @@ tag_key = 'tag2'
aggregator.register_schema(measurement, columns, column_key, tags, tag_key)
### store and aggregate data
### option 1: store data in row form
row_1 = {'time': 1234567890, 'fields': {'column1': 1.2, 'column2': 0.3}}
row_2 = {'time': 1234567890.5, 'fields': {'column1': 0.3, 'column2': 0.4}}
......@@ -61,6 +63,19 @@ rows = {('001', 'andrew'): [row_1, row_2], ('002', 'parce'): [row_3, row_4]}
aggregator.store_rows(measurement, rows)
### option 2: store data in column form
cols_1 = {
'time': [1234567890, 1234567890.5],
'fields': {'column1': [1.2, 0.3], 'column2': [0.3, 0.4]}
}
cols_2 = {
'time': [1234567890, 1234567890.5],
'fields': {'column1': [2.3, 0.1], 'column2': [1.1, 2.3]}
}
cols = {('001', 'andrew'): cols_1, ('002', 'parce'): cols_2}
aggregator.store_columns(measurement, cols)
```
## Installation:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment