TDengine/test/cases/02-Databases/01-Create/test_db_basic3.py

57 lines
1.7 KiB
Python
Raw Normal View History

2025-04-30 04:45:50 +00:00
import time
from new_test_framework.utils import tdLog, tdSql, sc, clusterComCheck, clusterComCheck
class TestDatabaseBasic3:
def setup_class(cls):
tdLog.debug(f"start to execute {__file__}")
def test_database_basic3(self):
2025-08-07 05:30:57 +00:00
"""Database: basic 3
2025-04-30 04:45:50 +00:00
2025-08-07 05:30:57 +00:00
1. Create database
2. Create normal table with the 'db.' prefix
3. Show tables using the 'db.' prefix
2025-04-30 04:45:50 +00:00
Catalog:
- Database:Create
Since: v3.0.0.0
Labels: common,ci
Jira: None
History:
2025-05-12 01:00:19 +00:00
- 2025-5-12 Simon Guan Migrated from tsim/db/basic3.sim
2025-04-30 04:45:50 +00:00
"""
tdLog.info(f"=============== create database d1")
tdSql.execute(f"create database d1")
tdSql.execute(f"create table d1.t1 (ts timestamp, i int);")
tdSql.execute(f"create table d1.t2 (ts timestamp, i int);")
tdSql.execute(f"create table d1.t3 (ts timestamp, i int);")
tdSql.execute(f"create table d1.t4 (ts timestamp, i int);")
tdSql.query(f"select * from information_schema.ins_databases")
tdSql.checkRows(3)
tdSql.checkData(2, 0, "d1")
tdSql.checkData(2, 2, 2)
tdSql.query(f"show d1.tables")
tdSql.checkRows(4)
tdLog.info(f"=============== create database d2")
tdSql.execute(f"create database d2")
tdSql.execute(f"create table d2.t1 (ts timestamp, i int);")
tdSql.execute(f"create table d2.t2 (ts timestamp, i int);")
tdSql.execute(f"create table d2.t3 (ts timestamp, i int);")
tdSql.query(f"select * from information_schema.ins_databases")
tdSql.checkRows(4)
tdSql.query(f"show d2.tables")
tdSql.checkRows(3)