diff --git a/docs/en/12-taos-sql/16-json.md b/docs/en/12-taos-sql/16-json.md index 7460a5e0ba3ce78ee7744569cda460c477cac19c..61c473d120fefba1ec92902f3e68aa7037875a72 100644 --- a/docs/en/12-taos-sql/16-json.md +++ b/docs/en/12-taos-sql/16-json.md @@ -52,9 +52,20 @@ title: JSON Type 4. Tag Operations - The value of a JSON tag can be altered. Please note that the full JSON will be overriden when doing this. + The value of a JSON tag can be altered. Please note that the full JSON will be overriden when doing this: + + ```sql + alter table s1_1 set tag info = '{"k1": "v2"}'; + ``` + + The name of a JSON tag can be altered: + + ```sql + alter stable s1 change tag info info2 ; + ``` + + A tag of JSON type can't be added or removed. The column length of a JSON tag can't be changed. - The name of a JSON tag can be altered. A tag of JSON type can't be added or removed. The column length of a JSON tag can't be changed. ## Other Restrictions diff --git a/docs/zh/12-taos-sql/16-json.md b/docs/zh/12-taos-sql/16-json.md index 4a4a8cca732ac433ba5ada1ec3805ebfa663edb3..d1f7b3300bca25e20affa023c402024de4a0efff 100644 --- a/docs/zh/12-taos-sql/16-json.md +++ b/docs/zh/12-taos-sql/16-json.md @@ -55,8 +55,17 @@ title: JSON 类型使用说明 4. 标签操作 支持修改 json 标签值(全量覆盖) + + + ``` + alter table s1_1 set tag info = '{"k1": "v2"}'; + ``` 支持修改 json 标签名 + + ``` + alter stable s1 change tag info info2 ; + ``` 不支持添加 json 标签、删除 json 标签、修改 json 标签列宽 diff --git a/docs/zh/20-third-party/12-IDEA.mdx b/docs/zh/20-third-party/12-IDEA.mdx index 2dd682f19908e10537044846fe55ab705592fd74..7d45c7f2ed385bbc3e8cea77c976cb6f0b418d08 100644 --- a/docs/zh/20-third-party/12-IDEA.mdx +++ b/docs/zh/20-third-party/12-IDEA.mdx @@ -59,13 +59,12 @@ IDEA Ultimate 版自带数据库管理工具,类似于一个小型 Navicat。 ![image](https://user-images.githubusercontent.com/70138133/180197251-98764434-bb7b-4e3a-9674-0620ab6d8bad.png) -## 验证 +## 验证方法 -- 配置完后进行验证,点击刷新后再点击显示所有数据库: +- 配置完后进行验证,刷新后点击显示所有数据库,看是否出现了所有的数据库: ![image](https://user-images.githubusercontent.com/70138133/180202803-6e277132-44bd-4b22-8921-a54d16190d2b.png) - - 右击数据源,新建查询控制台测试能否查询。需要注意的是,RESTful 请求是无状态的,查询、写入需要在表名前带上数据库名。 - 2.X 版本中默认带 log 库,我们可以使用 `SHOW log.stables` 查看包含哪些超级表后对特定表进行查询、调试: @@ -82,3 +81,4 @@ IDEA Ultimate 版自带数据库管理工具,类似于一个小型 Navicat。 ![image](https://user-images.githubusercontent.com/70138133/180205161-7f0314eb-cdaa-442c-acb5-d33931c32648.png) + diff --git a/docs/zh/20-third-party/14-DBeaver.mdx b/docs/zh/20-third-party/14-DBeaver.mdx new file mode 100644 index 0000000000000000000000000000000000000000..bbaa468f87d815b3b3b38f83074bc7e6d1696124 --- /dev/null +++ b/docs/zh/20-third-party/14-DBeaver.mdx @@ -0,0 +1,71 @@ +--- +sidebar_label: DBeaver +title: 通过开源数据库管理工具 DBeaver 连接 TDengine +--- + +DBeaver 是一款流行、开源的数据库管理工具以及 SQL 客户端,其功能强大,并且支持任何拥有 JDBC-Driver 的数据库(这意味着几乎所有数据库都支持)。 +其官网的介绍是这样的: +>Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases. Supports all popular databases: MySQL, PostgreSQL, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access, Teradata, Firebird, Apache Hive, Phoenix, Presto, etc. + +只需要简单的配置即可使用 DBeaver 来连接、管理 TDengine。 + +## 前置条件 +1. DBeaver 依赖 Java (JDK) 11 ,不过其安装包中已包含。可选安装 Maven、Git。 +2. 已安装并启动了 TDengine。 +3. 若使用原生连接(选择 TSDBDriver 驱动类),请在本地安装 TDengine 客户端。 +4. 若使用 REST 连接(选择 RestfulDriver 驱动类),请确保 taosAdapter 已经正常运行。 + +## 配置步骤 +- 可以克隆 DBeaver 在 [GitHub](https://github.com/dbeaver/dbeaver) 上的源码,执行 `mvn package`,也可以直接下载打包好的安装包。此处选择直接下载安装包。 +- 在 GitHub DBeaver 仓库的 [Releases](https://github.com/dbeaver/dbeaver/releases) 处下载对应版本的 DBeaver,比如系统为 macOS,处理器芯片是 M1 ,此处下载 dbeaver-ce-22.1.2-macos-aarch64.dmg 进行安装。推荐使用 22.1.2 版本的 DBeaver,后续版本未进行验证。 +- 点击数据库标签,选择驱动管理器: + +![image](https://user-images.githubusercontent.com/70138133/181191577-7bb91c96-b4fc-455f-9f6c-545993f0a445.png) + +- 新建驱动,选择 TDengine 的 JDBC Connector 驱动包(其中的 dist.jar 包),此驱动包可以下载或者自行编译、打包,参考 [IDEA-源码编译 JDBC-Connector](../IDEA/#%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91-jdbc-connector): + +![image](https://user-images.githubusercontent.com/70138133/181191709-fcc3faa3-cfe9-4b0b-8c1b-5074c9411c8b.png) + +- 添加后点击找到类,此处使用 RESTful 驱动类演示(注意:若使用 com.taosdata.jdbc.TSDBDriver 驱动类,则需要安装 TDengine 客户端): + +![image](https://user-images.githubusercontent.com/70138133/181191776-fc1ab7ff-b323-4913-92d7-aa5a10a5a6d8.png) + +- 填写一下驱动名称,简单填下配置: + +![image](https://user-images.githubusercontent.com/70138133/181191846-2c16b98a-c171-4936-a894-3fdaf96cfba1.png) + +- TDengine 的 JDBC URL 规范为: +`jdbc:[TAOS|TAOS-RS]://[host_name]:[port]/[database_name]?[user={user}|&password={password}|&charset={charset}|&cfgdir={config_dir}|&locale={locale}|&timezone={timezone}]` + +- 点击“新建连接”,搜索配置好的驱动名称,点击后进入下一步: + +![image](https://user-images.githubusercontent.com/70138133/181191887-cc13a397-64a0-4dfc-b42f-d65608e71eae.png) + +- 输入密码后,点击“测试连接”(注:需要在本机 hosts 文件上添加 URL 内域名的解析,URL 内的 locale、timezone 参数在 RESTful 连接中不生效): + +![image](https://user-images.githubusercontent.com/70138133/181191921-e5a05f93-0ef5-45fb-8707-5697bcdef64b.png) + +## 验证方法 +- 点击“测试连接”若弹出“已连接”的提示代表连接成功。界面左侧能看到刷新出来的数据库,点击特定的表可以查看表的结构及数据: + +![image](https://user-images.githubusercontent.com/70138133/181192410-e7509c1a-0f9c-4282-a69a-82685e659fd7.png) + +- 点击界面左上方的新建 SQL 编辑器,默认,输入 SQL 进行验证。需要注意的是,RESTful 请求是无状态的,查询、写入需要在表名前带上数据库名。 +- 2.X 版本中默认带 log 库,我们可以使用`SHOW log.stables;`查看包含哪些超级表后对特定表进行查询、调试: + +![image](https://user-images.githubusercontent.com/70138133/181192488-727c3c1d-906a-4fbe-bd2e-41678d5e1627.png) + +- 可以看到有个超级表叫做 dnodes_info,执行`describe log.dnodes_info;`查看表结构: + +![image](https://user-images.githubusercontent.com/70138133/181192651-0adaafeb-c7ff-4d02-93b4-e1e3aebb39ea.png) + +- 再执行`select last_row(*) from log.dnodes_info group by dnode_id;`通过 dnode_id 能分组查询各 dnode_id 下的最新一条数据: + +![image](https://user-images.githubusercontent.com/70138133/181192918-e71d6482-3901-4b14-956c-2894658e2b67.png) + +- 还有其他操作也可以自行测试,比如写入一条数据后进行查询: + +![image](https://user-images.githubusercontent.com/70138133/181192959-27b8ded5-9719-424a-ae08-3b5635dd7fbf.png) + +好了,到这里我们就大功告成了。DBeaver 功能强大,其他常用功能还包括导入导出 SQL 脚本、配置表过滤器、建立数据库任务等,大家可以慢慢体验。 + diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index ee3245dd575c230220fe71edb101388dcf8978a6..325225e6958e78d0a1dafa1b2a4bd021ab0c2228 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -320,7 +320,6 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex pthread_mutex_lock(&pQInfo->lock); - assert(pQInfo->rspContext == NULL); if (pQInfo->dataReady == QUERY_RESULT_READY) { *buildRes = true; qDebug("QInfo:0x%"PRIx64" retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo->qId, pQueryAttr->resultRowSize, diff --git a/tests/pytest/tools/taosdumpTest2.py b/tests/pytest/tools/taosdumpTest2.py index c0de2c957a59ff94ab22a8656f030719e60e5761..94c5adf30908174aaf1537d2ae314cf929fcab04 100644 --- a/tests/pytest/tools/taosdumpTest2.py +++ b/tests/pytest/tools/taosdumpTest2.py @@ -63,6 +63,7 @@ class TDTestCase: os.makedirs("./taosdumptest/tmp") else: print("directory exists") + os.system("rm -rf ./taosdumptest/tmp/*") tdSql.prepare() @@ -87,6 +88,7 @@ class TDTestCase: os.system("rm ./taosdumptest/tmp/*.sql") os.system("rm ./taosdumptest/tmp/*.avro*") + os.system("rm -rf ./taosdumptest/taosdump.*") os.system( "%s --databases db -o ./taosdumptest/tmp " % binPath) @@ -122,6 +124,7 @@ class TDTestCase: os.system("rm ./taosdumptest/tmp/*.sql") os.system("rm ./taosdumptest/tmp/*.avro*") + os.system("rm -rf ./taosdumptest/tmp/taosdump.*") os.system("%s -D test -o ./taosdumptest/tmp -y" % binPath) tdSql.execute("drop database test") diff --git a/tests/pytest/tools/taosdumpTest3.py b/tests/pytest/tools/taosdumpTest3.py index e8fb46f3a8740d1c0f0360ad6bf93c51475b5603..2a9561f7c54d0fa5f5428d2ea79533e6b83f94e4 100644 --- a/tests/pytest/tools/taosdumpTest3.py +++ b/tests/pytest/tools/taosdumpTest3.py @@ -59,6 +59,7 @@ class TDTestCase: os.makedirs("./taosdumptest") else: print("directory exists") + os.system("rm -rf ./taosdumptest/*") for i in range(1, 9): if not os.path.exists("./taosdumptest/tmp%d" % i): @@ -83,15 +84,15 @@ class TDTestCase: tdSql.execute( "create table st0_0 using st0 tags(0) st0_1 using st0 tags (1) ") tdSql.execute( - "insert into st0_0 values(1614218412000,8537,'R')(1614218422000,8538,'E')") + "insert into st0_0 values(1661997612000,8537,'R')(1661997622000,8538,'E')") tdSql.execute( - "insert into st0_1 values(1614218413000,1537,'A')(1614218423000,1538,'D')") + "insert into st0_1 values(1661997613000,1537,'A')(1661997623000,1538,'D')") tdSql.execute( "create table if not exists gt0 (ts timestamp, c0 int, c1 float) ") tdSql.execute( "create table if not exists gt1 (ts timestamp, c0 int, c1 double) ") - tdSql.execute("insert into gt0 values(1614218412000,637,8.861)") - tdSql.execute("insert into gt1 values(1614218413000,638,8.862)") + tdSql.execute("insert into gt0 values(1661997602000,637,8.861)") + tdSql.execute("insert into gt1 values(1661997603000,638,8.862)") # create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1 # \stb3,include ctables stb3_0 and stb3_1 @@ -103,35 +104,35 @@ class TDTestCase: tdSql.execute( "create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) ") tdSql.execute( - "insert into st0_0 values(1614218412000,8600,'R')(1614218422000,8600,'E')") + "insert into st0_0 values(1654218412000,8600,'R')(1654218422000,8600,'E')") tdSql.execute( - "insert into st0_1 values(1614218413000,8601,'A')(1614218423000,8601,'D')") + "insert into st0_1 values(1654218413000,8601,'A')(1654218423000,8601,'D')") tdSql.execute( "create stable st1(ts timestamp, c11 float, c12 nchar(10)) tags(t1 int)") tdSql.execute( "create table st1_0 using st1 tags(0) st1_1 using st1 tags(1) ") tdSql.execute( - "insert into st1_0 values(1614218412000,8610.1,'R')(1614218422000,8610.1,'E')") + "insert into st1_0 values(1654218412000,8610.1,'R')(1654218422000,8610.1,'E')") tdSql.execute( - "insert into st1_1 values(1614218413000,8611.2,'A')(1614218423000,8611.1,'D')") + "insert into st1_1 values(1654218413000,8611.2,'A')(1654218423000,8611.1,'D')") tdSql.execute( "create stable st2(ts timestamp, c21 float, c22 nchar(10)) tags(t1 int)") tdSql.execute( "create table st2_0 using st2 tags(0) st2_1 using st2 tags(1) ") tdSql.execute( - "insert into st2_0 values(1614218412000,8620.3,'R')(1614218422000,8620.3,'E')") + "insert into st2_0 values(1654218412000,8620.3,'R')(1654218422000,8620.3,'E')") tdSql.execute( - "insert into st2_1 values(1614218413000,8621.4,'A')(1614218423000,8621.4,'D')") + "insert into st2_1 values(1654218413000,8621.4,'A')(1654218423000,8621.4,'D')") tdSql.execute( "create table if not exists gt0 (ts timestamp, c00 int, c01 float) ") tdSql.execute( "create table if not exists gt1 (ts timestamp, c10 int, c11 double) ") tdSql.execute( "create table if not exists gt2 (ts timestamp, c20 int, c21 float) ") - tdSql.execute("insert into gt0 values(1614218412700,8637,78.86155)") + tdSql.execute("insert into gt0 values(1654218412700,8637,78.86155)") tdSql.execute( - "insert into gt1 values(1614218413800,8638,78.862020199)") - tdSql.execute("insert into gt2 values(1614218413900,8639,78.863)") + "insert into gt1 values(1654218413800,8638,78.862020199)") + tdSql.execute("insert into gt2 values(1654218413900,8639,78.863)") # create tdSql.execute("create database if not exists dp3 precision 'ns'") @@ -141,13 +142,15 @@ class TDTestCase: tdSql.execute( "create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) ") tdSql.execute( - "insert into st0_0 values(1614218412000000001,8600,'R')(1614218422000000002,8600,'E')") + "insert into st0_0 values(1654218412000000001,8600,'R')(1654218422000000002,8600,'E')") tdSql.execute( - "insert into st0_1 values(1614218413000000001,8601,'A')(1614218423000000002,8601,'D')") + "insert into st0_1 values(1654218413000000001,8601,'A')(1654218423000000002,8601,'D')") +# sys.exit(0) # # taosdump stable and general table os.system("%s -o ./taosdumptest/tmp1 -D dp1,dp2 -T 8 " % binPath) os.system("%s -o ./taosdumptest/tmp2 dp1 st0 gt0 -T 8 " % binPath) + #sys.exit(0) os.system( "%s -o ./taosdumptest/tmp3 dp2 st0 st1_0 gt0 -T 8 " % binPath)