Metadata-Version: 2.1
Name: questdb
Version: 2.0.2
Summary: QuestDB client library for Python
Author-email: Adam Cimarosti <adam@questdb.io>
License: Apache License 2.0
Project-URL: Homepage, https://questdb.io/
Project-URL: Changelog, https://py-questdb-client.readthedocs.io/en/latest/changelog.html
Project-URL: Documentation, https://py-questdb-client.readthedocs.io/en/latest/index.html
Project-URL: Source, https://github.com/questdb/py-questdb-client/
Project-URL: Tracker, https://github.com/questdb/py-questdb-client/issues
Project-URL: Slack, http://slack.questdb.io
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Rust
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Networking
Classifier: Topic :: Database :: Front-Ends
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE.txt
Provides-Extra: publish
Requires-Dist: twine; extra == "publish"
Requires-Dist: wheel; extra == "publish"
Provides-Extra: ci
Requires-Dist: cibuildwheel; extra == "ci"
Provides-Extra: dataframe
Requires-Dist: pandas; extra == "dataframe"
Requires-Dist: pyarrow; extra == "dataframe"
Requires-Dist: numpy; extra == "dataframe"

=================================
QuestDB Client Library for Python
=================================

This is the official Python client library for `QuestDB <https://questdb.io>`_.

This client library implements QuestDB's variant of the
`InfluxDB Line Protocol <https://questdb.io/docs/reference/api/ilp/overview/>`_
(ILP) over HTTP and TCP.

ILP provides the fastest way to insert data into QuestDB.

This implementation supports `authentication
<https://py-questdb-client.readthedocs.io/en/latest/conf.html#authentication>`_
and full-connection encryption with
`TLS <https://py-questdb-client.readthedocs.io/en/latest/conf.html#tls>`_.

Quickstart
==========

The latest version of the library is 2.0.2 (`changelog <https://py-questdb-client.readthedocs.io/en/latest/changelog.html>`_).

::

    python3 -m pip install -U questdb[dataframe]

Please start by `setting up QuestDB <https://questdb.io/docs/quick-start/>`_ . Once set up, you can use this library to insert data.

The most common way to insert data is from a Pandas dataframe.

.. code-block:: python

    import pandas as pd
    from questdb.ingress import Sender

    df = pd.DataFrame({
        'id': pd.Categorical(['toronto1', 'paris3']),
        'temperature': [20.0, 21.0],
        'humidity': [0.5, 0.6],
        'timestamp': pd.to_datetime(['2021-01-01', '2021-01-02'])})

    conf = f'http::addr=localhost:9000;'
    with Sender.from_conf(conf) as sender:
        sender.dataframe(df, table_name='sensors', at='timestamp')

You can also send individual rows. This only requires a more minimal installation::

    python3 -m pip install -U questdb

.. code-block:: python

    from questdb.ingress import Sender, TimestampNanos

    conf = f'http::addr=localhost:9000;'
    with Sender.from_conf(conf) as sender:
        sender.row(
            'sensors',
            symbols={'id': 'toronto1'},
            columns={'temperature': 20.0, 'humidity': 0.5},
            at=TimestampNanos.now())
        sender.flush()


To connect via the `older TCP protocol <https://py-questdb-client.readthedocs.io/en/latest/sender.html#ilp-tcp-or-ilp-http>`_, set the
`configuration string <https://py-questdb-client.readthedocs.io/en/latest/conf.html>`_ to:

.. code-block:: python

    conf = f'tcp::addr=localhost:9009;'
    with Sender.from_conf(conf) as sender:
        ...


You can continue by reading the
`Sending Data Over ILP <https://py-questdb-client.readthedocs.io/en/latest/sender.html>`_
guide.

Links
=====

* `Core database documentation <https://questdb.io/docs/>`_

* `Python library documentation <https://py-questdb-client.readthedocs.io/>`_

* `GitHub repository <https://github.com/questdb/py-questdb-client>`_

* `Package on PyPI <https://pypi.org/project/questdb/>`_

Community
=========

If you need help, you can ask on `Stack Overflow
<https://stackoverflow.com/questions/ask?tags=questdb&tags=py-questdb-client>`_:
We monitor the ``#questdb`` and ``#py-questdb-client`` tags.

Alternatively, you may find us on `Slack <https://slack.questdb.io>`_.

You can also `sign up to our mailing list <https://questdb.io/community/>`_
to get notified of new releases.


License
=======

The code is released under the `Apache License 2.0
<https://github.com/questdb/py-questdb-client/blob/main/LICENSE.txt>`_.
