diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index a1483a4..4259324 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ /build /dist __pycache__/ -setup.py +# setup.py # Compiled python modules. *.pyc diff --git a/pinform/__init__.py b/pinform/__init__.py index 9627620..5a89073 100644 --- a/pinform/__init__.py +++ b/pinform/__init__.py @@ -9,7 +9,8 @@ from .utils import dromedary_to_underline, underline_to_dromedary -name = "pinform" +__name__ = "pinform" +__version__ = '0.9.2' class MeasurementNameComponent(object): @@ -255,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 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: diff --git a/pyvenv.cfg b/pyvenv.cfg new file mode 100644 index 0000000..c4f8eb3 --- /dev/null +++ b/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /usr/local/bin +include-system-site-packages = false +version = 3.7.7 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1256005 --- /dev/null +++ b/setup.py @@ -0,0 +1,40 @@ +from pathlib import Path + +from setuptools import setup, find_packages # noqa: H301 + +with open('requirements.txt', 'r') as f: + requires = [x.strip() for x in f if x.strip()] + +with open('README.md', 'r') as f: + readme = f.read() + + +NAME = "pinform" + +meta = {} +with open(Path(__file__).parent / 'pinform' / '__init__.py') as f: + exec('\n'.join(l for l in f if l.startswith('__')), meta) + +setup( + name=NAME, + version=meta.get('__version__'), + description="Pinform with a minor edit.", + long_description=readme, + url="https://github.com/iDrwish/pinform", + keywords=["InfluxDB", "InfluxDB Python Client"], + install_requires=requires, + packages=find_packages(), + python_requires='>=3.6', + include_package_data=True, + data_files=['requirements.txt'], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Topic :: Database', + 'Topic :: Software Development :: Libraries', + 'Topic :: Software Development :: Libraries :: Python Modules', + ])