Metadata-Version: 2.2
Name: masterpiece_influx
Version: 0.1.2
Summary: Influx v3 timeseries plugin for `masterpiece` applications
Author-email: J Meskanen <juham.api@gmail.com>
Maintainer-email: "J. Meskanen" <juham.api@gmail.com>
License: MIT License
        ===========
        
        Copyright (c) 2024, Juha Meskanen
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        
        
Project-URL: Homepage, https://gitlab.com/juham/masterpiece_influx
Project-URL: Bug Reports, https://gitlab.com/juham/masterpiece
Project-URL: Source, https://gitlab.com/juham/masterpiece_influx
Project-URL: Say Thanks!, http://meskanen.com
Keywords: influx,masterpiece,database,timeseries
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.rst
Requires-Dist: masterpiece>=0.1.7
Requires-Dist: pytz>=2024.1
Requires-Dist: importlib-metadata
Requires-Dist: influxdb3-python>=0.3.0
Provides-Extra: dev
Requires-Dist: check-manifest; extra == "dev"

InfluxDB V3 Plugin for MasterPiece
==================================

This project adds InfluxDB V3 timeseries recording functionality to `MasterPiece` framework.


Usage
-----

Pre-requisities:

- Create Influx cloud account, or install local Influx instance. Please consult the Influx site for
  more information on this.


To install the 'masterpiece_influx' plugin:

.. code-block:: bash

  pip install masterpiece_influx

Once installed, you can create `~/.yourapp/config/Influx.json` configuration file to specify
information needed for reading and writing time series data to your Influx database. 

.. code-block:: text

  {
    "token": "your token",
    "org": "your organization",
    "host": "https://eu-central-1-1.aws.cloud2.influxdata.com",
    "database": "your database"
  }


To import and instantiate Influx database for use:

.. code-block:: python

  from masterpiece_influx import Influx

  db = Influx()


An example to write and read data:

.. code-block:: python


  db.write_dict(name="temperature", tags={"sensor": "A1"}, fields={"value": 23.4}, ts="2024-12-14T12:00:00Z")
  data = db.read_dict(measurement="temperature", start_time="2024-12-01T00:00:00Z")


Note
----

The `masterpiece_influx.Influx` class is an implementation of the abstract `masterpiece.TimeSeries` 
base class,  designed for reading and writing time series data.
The TimeSeries interface allows  all time series operations  in your application to remain 
implementation-independent. 



License
-------

This project is licensed under the MIT License - see the `LICENSE` file for details.
