Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
302c2ae
feat: add AGENTS.md for project overview and setup instructions
qevolg Mar 27, 2026
4c1f8f4
Refactor taos-ws-py integration and update SQLAlchemy dialect handling
qevolg Mar 27, 2026
32ac190
chore: remove AGENTS.md as part of project restructuring
qevolg Mar 27, 2026
6bf539b
refactor: clean up code formatting and remove unnecessary blank lines
qevolg Mar 27, 2026
ffc5476
feat: update dependencies to include SQLAlchemy in workflow tests
qevolg Mar 27, 2026
e4646e3
refactor: enhance native module loading and improve error handling in…
qevolg Mar 27, 2026
5ced096
fix: correct connection string formatting and enhance query parameter…
qevolg Mar 27, 2026
04edc29
Update dependency versions in pyproject.toml and clean up test script
qevolg Mar 27, 2026
a5b7419
fix: normalize handling of explicit empty passwords in connection args
qevolg Mar 28, 2026
d98643e
fix: correct SQL query formatting in get_indexes method
qevolg Mar 28, 2026
3fff78d
feat: enhance SQLAlchemy dialect with improved SQL rendering and sche…
qevolg Mar 28, 2026
6f252b0
fix: streamline classifiers in pyproject.toml by removing redundant e…
qevolg Mar 30, 2026
46eff51
fix: simplify native module loading logic in __init__.py
qevolg Mar 30, 2026
460ea72
refactor: simplify SQL execution and testing logic in sqlalchemy.py a…
qevolg Mar 30, 2026
22d8599
refactor: clean up comments and streamline code in sqlalchemy.py
qevolg Mar 30, 2026
52f39b4
fix: update SQL query construction in BaseDialect to use f-strings fo…
qevolg Mar 30, 2026
47ed6dd
refactor: remove unused tests and constants from test_sqlalchemy.py
qevolg Mar 30, 2026
5db302a
refactor: streamline test_sqlalchemy.py by removing unused code and e…
qevolg Mar 30, 2026
fd3b9de
refactor: simplify assertions in test_decode_binary_in_tmq for clarit…
qevolg Mar 30, 2026
4affc35
test: add test for legacy taosws submodule alias availability
qevolg Mar 30, 2026
6896b7d
fix: update test_decode_binary_in_tmq to handle multiple values corre…
qevolg Mar 30, 2026
1868e6b
refactor: remove unused import from sqlalchemy.py
qevolg Mar 30, 2026
fdf12e2
refactor: enhance test_read by parameterizing database name and impro…
qevolg Mar 31, 2026
ae89511
chore: update version to 0.6.7 and document enhancements in CHANGELOG
qevolg Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/taos-ws-py-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ jobs:
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
TEST_TD_3360: "true"
run: |
pip3 install pytest toml
pip3 install pytest toml sqlalchemy
pytest ./taos-ws-py/tests/
2 changes: 1 addition & 1 deletion .github/workflows/taos-ws-py-enterprise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ jobs:
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
TEST_TD_ENTERPRISE: "true"
run: |
pip3 install pytest toml
pip3 install pytest toml sqlalchemy
pytest ./taos-ws-py/tests/
2 changes: 1 addition & 1 deletion .github/workflows/taos-ws-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ jobs:
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
run: |
curl -L -u "$TDENGINE_TEST_USERNAME:$TDENGINE_TEST_PASSWORD" -d "show databases" localhost:6041/rest/sql
pip3 install pytest toml
pip3 install pytest toml sqlalchemy
pip3 install ./
pytest ./taos-ws-py/tests/

Expand Down
4 changes: 2 additions & 2 deletions examples/pandas-read-sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

protocol_and_port = {"taos": 6030, "taosrest": 6041, "taosws": 6041}

for (protocol, port) in protocol_and_port.items():
engine = create_engine(f"{protocol}://root:taosdata@localhost")
for protocol, port in protocol_and_port.items():
engine = create_engine(f"{protocol}://root:taosdata@localhost:{port}")
conn = engine.connect()
res = pandas.read_sql(text("show databases"), conn)
conn.close()
Expand Down
858 changes: 550 additions & 308 deletions poetry.lock

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ packages = [{ include = "taos" }, { include = "taosrest" }]
[tool.poetry.plugins."sqlalchemy.dialects"]
"taos" = "taos.sqlalchemy:TaosDialect"
"taosrest" = "taosrest.sqlalchemy:TaosRestDialect"
"taosws" = "taos.sqlalchemy:TaosWsDialect"

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
pytz = "*"
iso8601 = "1.0.2"
requests = ">=2.27.1"
requests = [
{ version = ">=2.33.0", python = ">=3.10,<4.0" },
{ version = ">=2.27.1,<2.33.0", python = ">=3.7,<3.10" },
]
typing-extensions = ">=4.2.0,<4.15.0"

[tool.poetry.dependencies.taos-ws-py]
Expand All @@ -36,7 +38,10 @@ typing = "*"
pytest = [{ version = "^7.2.0", python = ">=3.7,<4.0" }]
pytest-cov = "^4.0.0"
mypy = { version = "^0.910", python = "^3.6" }
black = [{ version = ">=21.0", python = ">=3.6.2,<4.0" }]
black = [
{ version = ">=26.3.1", python = ">=3.10,<4.0" },
{ version = ">=21.0,<26.3.1", python = ">=3.6.2,<3.10" },
]
sqlalchemy = { version = "^2.0.0", python = ">=3.7,<4.0" }
pandas = { version = ">=2.1.0", python = ">=3.9,<4.0" }
python-dotenv = { version = "0.20.0" }
Expand All @@ -50,7 +55,10 @@ typing = "*"
pytest = [{ version = "^7.2.0", python = ">=3.7,<4.0" }]
pytest-cov = "^4.0.0"
mypy = { version = "^0.910", python = "^3.6" }
black = [{ version = ">=21.0", python = ">=3.6.2,<4.0" }]
black = [
{ version = ">=26.3.1", python = ">=3.10,<4.0" },
{ version = ">=21.0,<26.3.1", python = ">=3.6.2,<3.10" },
]
sqlalchemy = { version = "^2.0.0", python = ">=3.7,<4.0" }
pandas = { version = ">=2.1.0", python = ">=3.9,<4.0" }
python-dotenv = { version = "0.20.0" }
Expand Down
6 changes: 6 additions & 0 deletions taos-ws-py/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Conventional Changelog](https://www.conventionalcommits.org/en/v1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.6.7 - 2026-03-31

### Enhancements:

- Move the `taosws` SQLAlchemy dialect into `taos-ws-py`, removing the need for a `taospy` dependency when using SQLAlchemy with `taosws`.

## v0.6.6 - 2026-03-05

### Features:
Expand Down
18 changes: 9 additions & 9 deletions taos-ws-py/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions taos-ws-py/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "taos-ws-py"
version = "0.6.6"
version = "0.6.7"
edition = "2021"
publish = false
license = "MIT"

[lib]
name = "taosws"
name = "_taosws"
crate-type = ["cdylib"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion taos-ws-py/examples/schemaless_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!
import taosws
from taosws.taosws import PySchemalessProtocol, PySchemalessPrecision
from taosws import PySchemalessProtocol, PySchemalessPrecision

import taos

Expand Down
22 changes: 22 additions & 0 deletions taos-ws-py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = ["maturin>=1.8,<2.0"]
build-backend = "maturin"

[project]
name = "taos-ws-py"
dynamic = ["version"]
description = "The official TDengine Python WebSocket connector"
readme = "README.md"
requires-python = ">=3.7"
license = { text = "MIT" }
classifiers = ["Programming Language :: Python", "Programming Language :: Rust"]

[project.optional-dependencies]
sqlalchemy = ["sqlalchemy>=2.0.0"]

[project.entry-points."sqlalchemy.dialects"]
taosws = "taosws.sqlalchemy:TaosWsDialect"

[tool.maturin]
python-source = "."
module-name = "taosws._taosws"
36 changes: 18 additions & 18 deletions taos-ws-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@ shadow_rs::shadow!(build);
// ```

create_exception!(
taosws,
_taosws,
Warning,
PyException,
"Calling some methods will produce warning."
);
create_exception!(taosws, Error, PyException, "The root error exception");
create_exception!(_taosws, Error, PyException, "The root error exception");
create_exception!(
taosws,
_taosws,
InterfaceError,
PyException,
"The low-level api caused exception"
);
create_exception!(taosws, DatabaseError, Error);
create_exception!(taosws, DataError, DatabaseError);
create_exception!(taosws, OperationalError, DatabaseError);
create_exception!(taosws, IntegrityError, DatabaseError);
create_exception!(taosws, InternalError, DatabaseError);
create_exception!(taosws, ProgrammingError, DatabaseError);
create_exception!(taosws, NotSupportedError, DatabaseError);

create_exception!(taosws, QueryError, DatabaseError);
create_exception!(taosws, FetchError, DatabaseError);

create_exception!(taosws, ConnectionError, Error, "Connection error");
create_exception!(_taosws, DatabaseError, Error);
create_exception!(_taosws, DataError, DatabaseError);
create_exception!(_taosws, OperationalError, DatabaseError);
create_exception!(_taosws, IntegrityError, DatabaseError);
create_exception!(_taosws, InternalError, DatabaseError);
create_exception!(_taosws, ProgrammingError, DatabaseError);
create_exception!(_taosws, NotSupportedError, DatabaseError);

create_exception!(_taosws, QueryError, DatabaseError);
create_exception!(_taosws, FetchError, DatabaseError);

create_exception!(_taosws, ConnectionError, Error, "Connection error");
create_exception!(
taosws,
_taosws,
AlreadyClosedError,
ConnectionError,
"Connection error"
);
create_exception!(taosws, ConsumerException, Error);
create_exception!(_taosws, ConsumerException, Error);

mod common;
mod consumer;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ fn blob_to_column(values: Vec<Option<Vec<u8>>>) -> PyColumnView {
}

#[pymodule]
fn taosws(py: Python<'_>, m: &PyModule) -> PyResult<()> {
fn _taosws(py: Python<'_>, m: &PyModule) -> PyResult<()> {
if std::env::var("RUST_LOG").is_ok() {
let _ = pretty_env_logger::try_init();
}
Expand Down
34 changes: 34 additions & 0 deletions taos-ws-py/taosws/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import importlib
import importlib.util
import pkgutil
import sys


__path__ = pkgutil.extend_path(__path__, __name__)


def _load_native_module():
full_name = f"{__name__}._taosws"
if importlib.util.find_spec(full_name) is not None:
return importlib.import_module(full_name)

raise ImportError(
"Failed to import native extension 'taosws._taosws'. " "Ensure taos-ws-py is built and installed correctly."
)


_native = _load_native_module()

sys.modules.setdefault(f"{__name__}.taosws", _native)

if hasattr(_native, "__all__"):
for name in _native.__all__:
globals()[name] = getattr(_native, name)
else:
for name in dir(_native):
if not name.startswith("_"):
globals()[name] = getattr(_native, name)

__doc__ = _native.__doc__
if hasattr(_native, "__all__"):
__all__ = _native.__all__
Loading
Loading