Package: apache-iotdb-nightly
Apache IoTDBApache IoTDB (Database for Internet of Things) is an IoT native database with high performance for
data management and analysis, deployable on the edge and the cloud. Due to its light-weight
architecture, high performance and rich feature set together with its deep integration with
Apache Hadoop, Spark and Flink, Apache IoTDB can meet the requirements of massive data storage,
high-speed data ingestion and complex data analysis in the IoT industrial fields.Apache IoTDB Python Client APIUsing the package, you can write data to IoTDB, read data from IoTDB and maintain the schema of IoTDB.RequirementsYou have to install thrift (>=0.13) before using the package.How to use (Example)First, download the package:pip3 install apache-iotdbYou can get an example of using the package to read and write data at here:Example(you need to addimport iotdbin the head of the file)Or:fromiotdb.SessionimportSessionip="127.0.0.1"port_="6667"username_='root'password_='root'session=Session(ip,port_,username_,password_)session.open(False)zone=session.get_time_zone()session.close()IoTDB TestcontainerThe Test Support is based on the libtestcontainers(https://testcontainers-python.readthedocs.io/en/latest/index.html) which you need to install in your project if you want to use the feature.To start (and stop) an IoTDB Database in a Docker container simply do:class MyTestCase(unittest.TestCase):

    def test_something(self):
        with IoTDBContainer() as c:
            session = Session('localhost', c.get_exposed_port(6667), 'root', 'root')
            session.open(False)
            result = session.execute_query_statement("SHOW TIMESERIES")
            print(result)
            session.close()by default it will load the imageapache/iotdb:latest, if you want a specific version just pass it like e.g.IoTDBContainer("apache/iotdb:0.10.0")to get version0.10.0running.Pandas SupportTo easily transform a query result to aPandas Dataframethe SessionDataSet has a method.todf()which consumes the dataset and transforms it to a pandas dataframe.Example:fromiotdb.SessionimportSessionip="127.0.0.1"port_="6667"username_='root'password_='root'session=Session(ip,port_,username_,password_)session.open(False)result=session.execute_query_statement("SELECT * FROM root.*")# Transform to Pandas Datasetdf=result.todf()session.close()# Now you can work with the dataframedf=...DevelopersIntroductionThis is an example of how to connect to IoTDB with python, using the thrift rpc interfaces. Things
are almost the same on Windows or Linux, but pay attention to the difference like path separator.Prerequisitespython3.7 or later is preferred.You have to install Thrift (0.11.0 or later) to compile our thrift file into python code. Below is the official
tutorial of installation, eventually, you should have a thrift executable.http://thrift.apache.org/docs/install/Before starting you need to installrequirements_dev.txtin your python environment, e.g. by callingpip install -r requirements_dev.txtCompile the thrift library and DebugIn the root of IoTDB's source code folder,  runmvn clean generate-sources -pl client-py -am.This will automatically delete and repopulate the folderiotdb/thriftwith the generated thrift files.
This folder is ignored from git and shouldnever be pushed to git!NoticeDo not uploadiotdb/thriftto the git repo.Session Client & ExampleWe packed up the Thrift interface inclient-py/src/iotdb/Session.py(similar with its Java counterpart), also provided
an example fileclient-py/src/SessionExample.pyof how to use the session module. please read it carefully.Or, another simple example:fromiotdb.SessionimportSessionip="127.0.0.1"port_="6667"username_='root'password_='root'session=Session(ip,port_,username_,password_)session.open(False)zone=session.get_time_zone()session.close()TestsPlease add your custom tests intestsfolder.
To run all defined tests just typepytest .in the root folder.NoticeSome tests need docker to be started on your system as a test instance is started in a docker container usingtestcontainers.Futher Toolsblackandflake8are installed for autoformatting and linting.
Both can be run byblack .orflake8 .respectively.ReleasingTo do a release just ensure that you have the right set of generated thrift files.
Then run linting and auto-formatting.
Then, ensure that all tests work (viapytest .).
Then you are good to go to do a release!Preparing your environmentFirst, install all necessary dev dependencies viapip install -r requirements_dev.txt.Doing the ReleaseThere is a convenient scriptrelease.shto do all steps for a release.
Namely, these areRemove all transient directories from last release (if exists)(Re-)generate all generated sources via mvnRun Linting (flake8)Run Tests via pytestBuildRelease to pypi