From ae24d9eac6ed8ec665e70f71f43573c4f1736fce Mon Sep 17 00:00:00 2001 From: Mohamed Darwish Date: Fri, 19 Jun 2020 23:41:18 +0200 Subject: [PATCH 1/3] Added double quotes around measurement_name in query string to cater for outlier cases where the measurement name already includes a dot retunring an error not matching a retention policy --- pinform/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pinform/client.py b/pinform/client.py index 830d1e6..3f161d7 100644 --- a/pinform/client.py +++ b/pinform/client.py @@ -186,7 +186,7 @@ def load_points(self, measurement_type: Type[T], name_components: Optional[Dict[ time_range: Union[datetime.date, Tuple[datetime.datetime, datetime.datetime]] = None, limit: Optional[int] = None, tz: pytz.UTC = pytz.utc) -> List[T]: # noinspection SqlNoDataSourceInspection - query_string = "SELECT * FROM {measurement_name}".format(measurement_name=Measurement.get_name(measurement_type, name_components=name_components)) + query_string = """SELECT * FROM "{measurement_name}" """.format(measurement_name=Measurement.get_name(measurement_type, name_components=name_components)) and_conditions_list = [] if tags is not None: @@ -322,7 +322,7 @@ def get_fields_as_series(self, measurement: Type[T], aggregated_field_names.append(aggregation_mode.get_result_field_name(field_name)) query_string += ', '.join(properties) - query_string += " FROM {measurement_name}".format(measurement_name=measurement_name) + query_string += """ FROM "{measurement_name}" """.format(measurement_name=measurement_name) and_conditions_list = [] if tags is not None: From 29a046ddc3414397177690382d02d117b22a2e2c Mon Sep 17 00:00:00 2001 From: Mohamed Darwish Date: Sat, 20 Jun 2020 00:03:33 +0200 Subject: [PATCH 2/3] added setup.py --- .DS_Store | Bin 0 -> 6148 bytes pinform/__init__.py | 3 ++- pyvenv.cfg | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 pyvenv.cfg diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Sat, 4 Jul 2020 13:28:08 +0200 Subject: [PATCH 3/3] bug fix in dynamic measurement name replacement --- pinform/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinform/__init__.py b/pinform/__init__.py index 04f9f41..5a89073 100644 --- a/pinform/__init__.py +++ b/pinform/__init__.py @@ -256,7 +256,7 @@ def get_name(cls, name_components: Dict[str, str] = None) -> str: if name_components is None: raise Exception('Measurement name resolution needs a component named ' + name_tag + ' but null name components is provided') if name_tag in name_components.keys(): - measurement_name.replace('(' + name_tag + ')', name_components[name_tag]) + measurement_name = measurement_name.replace('(' + name_tag + ')', name_components[name_tag]) else: raise Exception('Tag with name ' + name_tag + ' not provided in name resolution tags for resolving dynamic measurement name') return measurement_name