Skip to content

influxdb: skip DataFrameClient with INFLUXDB_NO_DATAFRAME_CLIENT #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ Examples

Here's a basic example (for more see the examples directory)::

$ python
# Since the DataFrame client is slow to import, if you only need InfluxDBClient,
# use INFLUXDB_NO_DATAFRAME_CLIENT.
$ INFLUXDB_NO_DATAFRAME_CLIENT=1 python

>>> from influxdb import InfluxDBClient

Expand Down
3 changes: 3 additions & 0 deletions docs/source/api-documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ To connect to a InfluxDB, you must create a
connects to InfluxDB on ``localhost`` with the default
ports. The below instantiation statements are all equivalent::

# Set INFLUXDB_NO_DATAFRAME_CLIENT to save import time for InfluxDBClient
import os
os.environ[ "INFLUXDB_NO_DATAFRAME_CLIENT" ] = "1"
from influxdb import InfluxDBClient

# using Http
Expand Down
2 changes: 2 additions & 0 deletions examples/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import argparse

import os
os.environ[ "INFLUXDB_NO_DATAFRAME_CLIENT" ] = "1"
from influxdb import InfluxDBClient


Expand Down
11 changes: 8 additions & 3 deletions influxdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@
from __future__ import unicode_literals

from .client import InfluxDBClient
from .dataframe_client import DataFrameClient
from .helper import SeriesHelper

import os

_DATAFRAME_CLIENT = "INFLUXDB_NO_DATAFRAME_CLIENT" not in os.environ
if _DATAFRAME_CLIENT:
from .dataframe_client import DataFrameClient


__all__ = [
'InfluxDBClient',
'DataFrameClient',
'SeriesHelper',
]

if _DATAFRAME_CLIENT:
__all__.append( 'DataFrameClient' )

__version__ = '5.0.0'