From 2e8c58867008227989742f9949d9e23048c4144b Mon Sep 17 00:00:00 2001 From: Emmanuel Levijarvi Date: Sat, 3 Dec 2016 10:19:26 -0800 Subject: [PATCH 1/2] fix for using from_DSN constructor with dataframe --- influxdb/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index b9faa4f0..1a0a4821 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -131,8 +131,8 @@ def _port(self): def _get_port(self): return self.__port - @staticmethod - def from_DSN(dsn, **kwargs): + @classmethod + def from_DSN(cls, dsn, **kwargs): """Return an instance of :class:`~.InfluxDBClient` from the provided data source name. Supported schemes are "influxdb", "https+influxdb" and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient` @@ -169,7 +169,7 @@ def from_DSN(dsn, **kwargs): init_args['port'] = port init_args.update(kwargs) - return InfluxDBClient(**init_args) + return cls(**init_args) def switch_database(self, database): """Change the client's database. From 9812d0fd39315136f5f5f5d15725ca73d9a5606a Mon Sep 17 00:00:00 2001 From: Emmanuel Levijarvi Date: Wed, 7 Dec 2016 09:29:01 -0800 Subject: [PATCH 2/2] add DataFrameClient test for DSN constructor --- influxdb/tests/dataframe_client_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/influxdb/tests/dataframe_client_test.py b/influxdb/tests/dataframe_client_test.py index 782e5c82..dfff0df2 100644 --- a/influxdb/tests/dataframe_client_test.py +++ b/influxdb/tests/dataframe_client_test.py @@ -553,3 +553,8 @@ def test_datetime_to_epoch(self): cli._datetime_to_epoch(timestamp, time_precision='n'), 1356998400000000000.0 ) + + def test_dsn_constructor(self): + client = DataFrameClient.from_DSN('influxdb://localhost:8086') + self.assertIsInstance(client, DataFrameClient) + self.assertEqual('http://localhost:8086', client._baseurl) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy