Skip to content

Commit 7e49c13

Browse files
authored
Merge pull request #3 from jdoyle93/client-import-time-arista
Allow skipping DataFrameClient import
2 parents 9909a9f + f167b5e commit 7e49c13

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

docs/source/api-documentation.rst

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ To connect to a InfluxDB, you must create a
1010
connects to InfluxDB on ``localhost`` with the default
1111
ports. The below instantiation statements are all equivalent::
1212

13+
# Set INFLUXDB_NO_DATAFRAME_CLIENT to skip the expensive DataFrameClient
14+
# import in cases where you only need the basic InfluxDBClient.
15+
os.environ["INFLUXDB_NO_DATAFRAME_CLIENT"] = "1"
16+
1317
from influxdb import InfluxDBClient
1418

1519
# using Http

examples/tutorial.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import argparse
55

6+
import os
7+
os.environ["INFLUXDB_NO_DATAFRAME_CLIENT"] = "1"
68
from influxdb import InfluxDBClient
79

810

influxdb/__init__.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@
66
from __future__ import print_function
77
from __future__ import unicode_literals
88

9+
import os
10+
911
from .client import InfluxDBClient
10-
from .dataframe_client import DataFrameClient
1112
from .helper import SeriesHelper
1213

1314

1415
__all__ = [
1516
'InfluxDBClient',
16-
'DataFrameClient',
1717
'SeriesHelper',
1818
]
1919

20+
NO_DATAFRAME_CLIENT = os.environ.get("INFLUXDB_NO_DATAFRAME_CLIENT", "0")
21+
if NO_DATAFRAME_CLIENT.lower() not in ("1", "true"):
22+
from .dataframe_client import DataFrameClient # noqa: F401 unused import
23+
__all__.append("DataFrameClient")
24+
2025

2126
__version__ = '5.0.0'

0 commit comments

Comments
 (0)