Skip to content

Commit

Permalink
TST: use sqlalchemy text clause
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcBresson committed Nov 26, 2024
1 parent 35352d9 commit b75b895
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions iotdb-client/client-py/iotdb/sqlalchemy/tests/test_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from sqlalchemy import create_engine, inspect
from sqlalchemy.dialects import registry
from sqlalchemy.orm import Session
from sqlalchemy.sql import text

final_flag = True
failed_count = 0
Expand Down Expand Up @@ -54,16 +55,22 @@ def test_dialect():
eng = create_engine(url)

with Session(eng) as session:
session.execute("create database root.cursor")
session.execute("create database root.cursor_s1")
session.execute(text("create database root.cursor"))
session.execute(text("create database root.cursor_s1"))
session.execute(
"create timeseries root.cursor.device1.temperature with datatype=FLOAT,encoding=RLE"
text(
"create timeseries root.cursor.device1.temperature with datatype=FLOAT,encoding=RLE"
)
)
session.execute(
"create timeseries root.cursor.device1.status with datatype=FLOAT,encoding=RLE"
text(
"create timeseries root.cursor.device1.status with datatype=FLOAT,encoding=RLE"
)
)
session.execute(
"create timeseries root.cursor.device2.temperature with datatype=FLOAT,encoding=RLE"
text(
"create timeseries root.cursor.device2.temperature with datatype=FLOAT,encoding=RLE"
)
)

insp = inspect(eng)
Expand All @@ -84,8 +91,8 @@ def test_dialect():
print_message("test get_columns failed!")

with Session(eng) as session:
session.execute("delete database root.cursor")
session.execute("delete database root.cursor_s1")
session.execute(text("delete database root.cursor"))
session.execute(text("delete database root.cursor_s1"))

# close engine
eng.dispose()
Expand Down

0 comments on commit b75b895

Please sign in to comment.