8000 Fixing tutorial by nathan-sixnines · Pull Request #737 · influxdata/influxdb-python · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Fixing tutorial #737

Merged
merged 1 commit into from
Aug 8, 2019
Merged

Fixing tutorial #737

merged 1 commit into from
Aug 8, 2019

Conversation

nathan-sixnines
Copy link
Contributor

The tutorial did not work for me with the protocol set to json.
It ran without errors but nothing was written to the database.
It worked as expected after changing the protocol to line.
Banged my head against a wall here for a while, would like to save others the trouble.

@sebito91
Copy link
Contributor
sebito91 commented Aug 8, 2019

Thanks for the commit @Aeium! Can you please help me understand what issue you're having with the json protocol in the tutorial you've referenced?

  1. Which version of pandas + python are you using?
  2. Which version of influxdb are you using?
  3. Do you have any logs from influxdb that you can share?

Thanks!

@sebito91
Copy link
Contributor
sebito91 commented Aug 8, 2019

I think I'm seeing the bug...

points = [
{'measurement': measurement,
'tags': dict(list(tag.items()) + list(tags.items())),
'fields': rec,
'time': np.int64(ts.value / precision_factor)}
for ts, tag, rec in zip(dataframe.index,
dataframe[tag_columns].to_dict('record'),
dataframe[field_columns].to_dict('record'))
]

The tag_columns list is empty in both examples, and since zip stops when the shortest element is exhausted we end up with an empty object at the end of it.

Another thing I've noticed is that all of the dataframe tests are using line protocol, so there are a couple of issues we'll need to address to fix this.

Thanks again for pointing this out!

@sebito91 sebito91 self-assigned this Aug 8, 2019
Copy link
Contributor
@sebito91 sebito91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll accept this one for now as we'd like to have a working tutorial, but will need to follow up to clean up the json processing for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0