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

DataFrameClient for InfluxDB 0.9 #163

Merged
merged 18 commits into from
May 8, 2015
Merged

DataFrameClient for InfluxDB 0.9 #163

merged 18 commits into from
May 8, 2015

Conversation

tzonghao
Copy link
Contributor

#108

  • get_list_series returns a mapping from measurement names to DataFrame representing tags for the named measurement.
  • query returns a mapping from (measurement, (tag (k, v) pairs), to DataFrame representing time series for the measurement (qualified by tags) in question. Query without tags should simply use measurement as keys.
  • write_points converts a mapping of DataFrame objects as points, then hand them over to super's write_points.

@aviau
Copy link
Collaborator

aviau commented Apr 23, 2015

Hi,

Thank you for taking on this issue :)

Have you looked at client_test_with_server.py? I would like some DaframeClient tests there.

You are using the u'string' syntax, which does not work in python 3.2.

Other than that, this looks great!

//cc @timtroendle

@tzonghao
Copy link
Contributor Author

@ReAzem In case you haven't reviewed it, a few basic tests were added in client_test_with_server.py in this pull request as suggested. The 3.2 syntax problem is also fixed. I've also changed the key data structure for data dictionary's keys, for both querying and submitting, where strings can be used as keys if no tags are used. Otherwise, the keys can be a tuple of (measurement, sorted tuple of tag key-value pairs).

# Conflicts:
#	tests/influxdb/client_test_with_server.py
@aviau
Copy link
Collaborator

aviau commented Apr 30, 2015

@tzonghao Hello,

Thank you for the great work. Why are you not using the ResultSet Object? You should not have to use the raw property.

@tzonghao
Copy link
Contributor Author

@ReAzem You're right. Using ResultSet is cleaner. It's converted in the last commit.

@aviau
Copy link
Collaborator

aviau commented May 5, 2015

@tzonghao Can you change the write_points function to accept three arguments instead?

  • measurment name
  • tags (optional)
  • dataframe

I think it would be more intuitive than a tuple of key-value tuples.

That would be my last request before we merge :)

@tzonghao
Copy link
Contributor Author

tzonghao commented May 5, 2015

@ReAzem Sure, I can make that change. It also implicates that write_points will accept one DataFrame at a time, instead of multiple DataFrames.

@aviau
Copy link
Collaborator

aviau commented May 5, 2015

@tzonghao I think it would be worth it, do you agree?

@tzonghao
Copy link
Contributor Author

tzonghao commented May 5, 2015

I agree. It's a good decision.

@tzonghao
Copy link
Contributor Author

tzonghao commented May 5, 2015

@ReAzem It looks like an InfluxDB error in the last Travis run that failed the py34 test. Can you trigger a rerun?

@@ -22,6 +22,9 @@ def main(host='localhost', port=8086):
print("Write DataFrame")
client.write_points({'demo': df})

print("Write DataFrame with Tags")
client.write_points({('demo', (('k1', 'v1'), ('k2', 'v2'))): df})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this works anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch

@aviau
Copy link
Collaborator

aviau commented May 8, 2015

Great work! I will be merging this for now. I'm sure we can keep on improving it after feedback from other users.

aviau added a commit that referenced this pull request May 8, 2015
DataFrameClient for InfluxDB 0.9 (Thanks @tzonghao !)
@aviau aviau merged commit ae45809 into influxdata:master May 8, 2015
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