Skip to content

Commit 68c84f8

Browse files
authored
enh: move the taosws SQLAlchemy dialect into taos-ws-py (#387)
* feat: add AGENTS.md for project overview and setup instructions * Refactor taos-ws-py integration and update SQLAlchemy dialect handling - Removed TaosWsDialect from taos/sqlalchemy.py and moved it to taos-ws-py/taosws/sqlalchemy.py for better separation of concerns. - Updated taos-ws-py/Cargo.toml to change the library name to _taosws for internal consistency. - Adjusted import paths in examples and tests to reflect the new module structure. - Added comprehensive tests for the taosws SQLAlchemy dialect to ensure compatibility and functionality. - Updated AGENTS.md to clarify project structure and development setup for taos-ws-py. - Removed deprecated taosws tests from the main test suite and integrated them into the new taos-ws-py test structure. * chore: remove AGENTS.md as part of project restructuring * refactor: clean up code formatting and remove unnecessary blank lines * feat: update dependencies to include SQLAlchemy in workflow tests * refactor: enhance native module loading and improve error handling in SQLAlchemy dialect * fix: correct connection string formatting and enhance query parameter encoding in SQLAlchemy dialect tests * Update dependency versions in pyproject.toml and clean up test script - Adjusted requests and black dependencies to support specific Python versions. - Updated pandas and sqlalchemy dependencies to ensure compatibility. - Removed unnecessary newline in test_taospy.sh for cleaner script execution. * fix: normalize handling of explicit empty passwords in connection args * fix: correct SQL query formatting in get_indexes method * feat: enhance SQLAlchemy dialect with improved SQL rendering and schema injection prevention * fix: streamline classifiers in pyproject.toml by removing redundant entries * fix: simplify native module loading logic in __init__.py * refactor: simplify SQL execution and testing logic in sqlalchemy.py and test_sqlalchemy.py * refactor: clean up comments and streamline code in sqlalchemy.py * fix: update SQL query construction in BaseDialect to use f-strings for schema and table name * refactor: remove unused tests and constants from test_sqlalchemy.py * refactor: streamline test_sqlalchemy.py by removing unused code and enhancing test readability * refactor: simplify assertions in test_decode_binary_in_tmq for clarity and correctness * test: add test for legacy taosws submodule alias availability * fix: update test_decode_binary_in_tmq to handle multiple values correctly * refactor: remove unused import from sqlalchemy.py * refactor: enhance test_read by parameterizing database name and improving resource management * chore: update version to 0.6.7 and document enhancements in CHANGELOG
1 parent 2fe2bb8 commit 68c84f8

24 files changed

Lines changed: 1471 additions & 559 deletions

.github/workflows/taos-ws-py-compatibility.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ jobs:
111111
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
112112
TEST_TD_3360: "true"
113113
run: |
114-
pip3 install pytest toml
114+
pip3 install pytest toml sqlalchemy
115115
pytest ./taos-ws-py/tests/

.github/workflows/taos-ws-py-enterprise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ jobs:
117117
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
118118
TEST_TD_ENTERPRISE: "true"
119119
run: |
120-
pip3 install pytest toml
120+
pip3 install pytest toml sqlalchemy
121121
pytest ./taos-ws-py/tests/

.github/workflows/taos-ws-py.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ jobs:
225225
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
226226
run: |
227227
curl -L -u "$TDENGINE_TEST_USERNAME:$TDENGINE_TEST_PASSWORD" -d "show databases" localhost:6041/rest/sql
228-
pip3 install pytest toml
228+
pip3 install pytest toml sqlalchemy
229229
pip3 install ./
230230
pytest ./taos-ws-py/tests/
231231

examples/pandas-read-sql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

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

6-
for (protocol, port) in protocol_and_port.items():
7-
engine = create_engine(f"{protocol}://root:taosdata@localhost")
6+
for protocol, port in protocol_and_port.items():
7+
engine = create_engine(f"{protocol}://root:taosdata@localhost:{port}")
88
conn = engine.connect()
99
res = pandas.read_sql(text("show databases"), conn)
1010
conn.close()

poetry.lock

Lines changed: 550 additions & 308 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ packages = [{ include = "taos" }, { include = "taosrest" }]
1212
[tool.poetry.plugins."sqlalchemy.dialects"]
1313
"taos" = "taos.sqlalchemy:TaosDialect"
1414
"taosrest" = "taosrest.sqlalchemy:TaosRestDialect"
15-
"taosws" = "taos.sqlalchemy:TaosWsDialect"
1615

1716
[tool.poetry.dependencies]
1817
python = ">=3.7,<4.0"
1918
pytz = "*"
2019
iso8601 = "1.0.2"
21-
requests = ">=2.27.1"
20+
requests = [
21+
{ version = ">=2.33.0", python = ">=3.10,<4.0" },
22+
{ version = ">=2.27.1,<2.33.0", python = ">=3.7,<3.10" },
23+
]
2224
typing-extensions = ">=4.2.0,<4.15.0"
2325

2426
[tool.poetry.dependencies.taos-ws-py]
@@ -36,7 +38,10 @@ typing = "*"
3638
pytest = [{ version = "^7.2.0", python = ">=3.7,<4.0" }]
3739
pytest-cov = "^4.0.0"
3840
mypy = { version = "^0.910", python = "^3.6" }
39-
black = [{ version = ">=21.0", python = ">=3.6.2,<4.0" }]
41+
black = [
42+
{ version = ">=26.3.1", python = ">=3.10,<4.0" },
43+
{ version = ">=21.0,<26.3.1", python = ">=3.6.2,<3.10" },
44+
]
4045
sqlalchemy = { version = "^2.0.0", python = ">=3.7,<4.0" }
4146
pandas = { version = ">=2.1.0", python = ">=3.9,<4.0" }
4247
python-dotenv = { version = "0.20.0" }
@@ -50,7 +55,10 @@ typing = "*"
5055
pytest = [{ version = "^7.2.0", python = ">=3.7,<4.0" }]
5156
pytest-cov = "^4.0.0"
5257
mypy = { version = "^0.910", python = "^3.6" }
53-
black = [{ version = ">=21.0", python = ">=3.6.2,<4.0" }]
58+
black = [
59+
{ version = ">=26.3.1", python = ">=3.10,<4.0" },
60+
{ version = ">=21.0,<26.3.1", python = ">=3.6.2,<3.10" },
61+
]
5462
sqlalchemy = { version = "^2.0.0", python = ">=3.7,<4.0" }
5563
pandas = { version = ">=2.1.0", python = ">=3.9,<4.0" }
5664
python-dotenv = { version = "0.20.0" }

taos-ws-py/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Conventional Changelog](https://www.conventionalcommits.org/en/v1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## v0.6.7 - 2026-03-31
9+
10+
### Enhancements:
11+
12+
- Move the `taosws` SQLAlchemy dialect into `taos-ws-py`, removing the need for a `taospy` dependency when using SQLAlchemy with `taosws`.
13+
814
## v0.6.6 - 2026-03-05
915

1016
### Features:

taos-ws-py/Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

taos-ws-py/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "taos-ws-py"
3-
version = "0.6.6"
3+
version = "0.6.7"
44
edition = "2021"
55
publish = false
66
license = "MIT"
77

88
[lib]
9-
name = "taosws"
9+
name = "_taosws"
1010
crate-type = ["cdylib"]
1111

1212
[dependencies]

taos-ws-py/examples/schemaless_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!
22
import taosws
3-
from taosws.taosws import PySchemalessProtocol, PySchemalessPrecision
3+
from taosws import PySchemalessProtocol, PySchemalessPrecision
44

55
import taos
66

0 commit comments

Comments
 (0)