Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Using InfluxDBClient object in context manager #905

Open
sebbleroni opened this issue Nov 16, 2021 · 1 comment
Open

Using InfluxDBClient object in context manager #905

sebbleroni opened this issue Nov 16, 2021 · 1 comment

Comments

@sebbleroni
Copy link

I recently started using influxdb and I am struggeling to use a InfluxDBClient() object as a context manager as mentioned in the documentation (https://influxdb-python.readthedocs.io/en/latest/api-documentation.html#influxdbclient). As a minimal working example I tried

with InfluxDBClient() as client:
    print(client)

which returned None.

This behaviour can most likely be explained by the lack of the InfluxDBClient.__enter__() function in the version 5.3.1 I got from pip. Is there a reason why this addition of this function is not (yet) reflected in the pip version? If not, is it safe to install the version that is currently on the master branch?

Very kind regards and many thanks for the development of this amazing package!


  • InfluxDB version: 1.8.10
  • InfluxDB-python version: 5.3.1
  • Python version: 3.8.10
  • Operating system version: Ubuntu 20.04
@yabberyabber
Copy link

It looks like the 5.3.1 tag has gone missing. Unsure why or how. However, if you look at the latest code in the master branch you will see that there is now an __enter__ and an __exit__. Hopefully soon the authors can create a 5.3.2 tag which includes that.

def __enter__(self):

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

No branches or pull requests

2 participants