Skip to main content

TDengine Python Connector

GitHub Actions Workflow Status codecov GitHub commit activity PyPI GitHub License PyPI
Twitter Follow YouTube Channel Discord Community LinkedIn StackOverflow

English | 简体中文

Table of Contents

1. Introduction

taospy is the official Python Connector for TDengine, allowing Python developers to develop applications that access the TDengine database. It supports functions such as data writing, querying, subscription, schemaless writing, and parameter binding.

The API for taospy is compliant with the Python DB API 2.0 (PEP-249). It contains two modules:

  1. The taos module. It uses TDengine C client library for client server communications.
  2. The taosrest module. It wraps TDengine RESTful API to Python DB API 2.0 (PEP-249). With this module, you do not need to install the TDengine C client library.

2. Documentation

  • To use Python Connector, please check Developer Guide, which includes how an application can introduce the Python Connector , as well as examples of data writing, querying, schemaless writing, parameter binding, and data subscription.
  • For other reference information, please check Reference Manual, which includes version history, data types, example programs, API descriptions, and FAQs.
  • This quick guide is mainly for developers who like to contribute/build/test the Python Connector by themselves. To learn about TDengine, you can visit the official documentation.

3. Prerequisites

System Requirements

  • Python >= 3.7, pip
  • For taos native connector: TDengine client library (libtaos.so)
  • For taos-ws-py: Rust toolchain >= 1.64, maturin
  • TDengine has been deployed locally. For specific steps, please refer to Deploy TDengine, and taosd and taosAdapter have been started.

Installing Build Tools

Ubuntu/Debian:

sudo apt-get install -y python3 python3-pip python3-venv

CentOS/RHEL:

sudo yum install -y python3 python3-pip

Installing maturin (for taos-ws-py only)

pip3 install maturin

4. Building

# taospy (pure Python)
git clone https://github.com/taosdata/taos-connector-python.git
cd taos-connector-python
pip3 install -e ".[dev]"

# taos-ws-py (Rust WebSocket bindings)
cd taos-ws-py
maturin develop    # builds and installs in current venv
# or
maturin build --release   # produces a wheel in target/wheels/

5. Testing

5.1 Test Execution

The Python Connector testing framework is pytest
The testing directory for taospy is located in the root directory: tests/
The testing directory for taos-ws-py is located in the root directory: taos-ws-py/tests/
The test code has been written into one bash file. You can open and view the detailed testing process
The following command runs all test cases on Linux platform:

# taospy
pytest tests/
# or
bash ./test_taospy.sh
# taos-ws-py
cd taos-ws-py
maturin develop
pytest tests/
cd ..
# or
bash ./test_taos-ws-py.sh

5.2 Test Case Addition

You can add new test files or add test cases in existing test files that comply with pytest standards

5.3 Performance Testing

Performance testing is in progress.

6. Packaging

# taospy
python3 -m build
# Output: dist/taospy-<version>.tar.gz, dist/taospy-<version>-py3-none-any.whl

# taos-ws-py
cd taos-ws-py
maturin build --release
# Output: target/wheels/taos_ws_py-<version>-*.whl

7. CI/CD

8. Submitting Issues

We welcome the submission of GitHub Issue. When submitting, please provide the following information:

  • Problem description, whether it always occurs, and it's best to include a detailed call stack.
  • Python Connector version.
  • Python Connection parameters (username and password not required).
  • TDengine server version.

9. Submitting PRs

We welcome developers to contribute to this project. When submitting PRs, please follow these steps:

  1. Fork this project, refer to (how to fork a repo).
  2. Create a new branch from the main branch with a meaningful branch name (git checkout -b my_branch). Do not modify the main branch directly.
  3. Modify the code, ensure all unit tests pass, and add new unit tests to verify the changes.
  4. Push the changes to the remote branch (git push origin my_branch).
  5. Create a Pull Request on GitHub (how to create a pull request).
  6. After submitting the PR, you can find your PR through the Pull Request. Click on the corresponding link to see if the CI for your PR has passed. If it has passed, it will display "All checks have passed". Regardless of whether the CI passes or not, you can click "Show all checks" -> "Details" to view the detailed test case logs.
  7. After submitting the PR, if CI passes, you can find your PR on the codecov page to check the test coverage.

10. References

11. License

MIT License

Release files for taospy 2.8.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taospy 2.8.10
File Size Uploaded
taospy-2.8.10.tar.gz 52.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taospy 2.8.10
File Interpreter ABI Platform
taospy-2.8.10-py3-none-any.whl Python 3 none any Details

Total release size: 110.5 kB

Release files / taospy-2.8.10.tar.gz

Download URL taospy-2.8.10.tar.gz
Size 52.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1ebbefeb99058ef36aa8a406c99927a55daae3268018ce9a99f4db2e4df998ec
BLAKE2b-256 checksum
How to use checksums
91e7a13b7bd879f9c81afc733591d7abbfe3e8a35c31f3d45ff9c6aad747f3fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.12 Linux/6.8.0-1062-azure

Release files / taospy-2.8.10-py3-none-any.whl

Download URL taospy-2.8.10-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d1434867eed295394ade35fdb5c02940a1f017ba7cd5d7e9e1a828d73e577c5
BLAKE2b-256 checksum
How to use checksums
0a2897392ef6857c42a35f5b42d44dd1b035f92f840e4865b8aabec9210549b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.12 Linux/6.8.0-1062-azure

Release history Release notifications | RSS feed

This release

2.8.10 This release

2 release files

2.8.9

2 release files

2.8.8

2 release files

2.8.6

2 release files

2.8.5

2 release files

2.8.4

2 release files

2.8.3

2 release files

2.8.2

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.23

2 release files

2.7.21

2 release files

2.7.19

2 release files

2.7.18

2 release files

2.7.16

2 release files

2.7.15

2 release files

2.7.14

2 release files

2.7.13

2 release files

2.7.12

2 release files

2.7.9

2 release files

2.7.8

2 release files

2.7.7

2 release files

2.7.6

2 release files

2.7.5

2 release files

2.7.4

2 release files

2.7.3

1 release file

2.7.2

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.10

2 release files

2.6.9

2 release files

2.6.8

2 release files

2.6.7

2 release files

2.6.6

2 release files

2.6.5

2 release files

2.6.4

2 release files

2.6.3

2 release files

2.6.2

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.7

2 release files

2.3.6

2 release files

2.3.5

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page