Merge branch '3.0' into feat/TD-26529-3.0
This commit is contained in:
commit
39f2e75a9e
|
@ -1,4 +1,4 @@
|
|||
build/
|
||||
*build/
|
||||
compile_commands.json
|
||||
CMakeSettings.json
|
||||
.cache
|
||||
|
@ -11,6 +11,7 @@ CMakeSettings.json
|
|||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
cscope.out
|
||||
cscope.files
|
||||
.DS_Store
|
||||
debug/
|
||||
release/
|
||||
|
@ -131,3 +132,5 @@ tools/taos-tools
|
|||
tools/taosws-rs
|
||||
tags
|
||||
.clangd
|
||||
*CMakeCache*
|
||||
*CMakeFiles*
|
||||
|
|
|
@ -41,6 +41,7 @@ add_subdirectory(source)
|
|||
add_subdirectory(tools)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(examples/c)
|
||||
add_subdirectory(tests)
|
||||
include(${TD_SUPPORT_DIR}/cmake.install)
|
||||
|
||||
# docs
|
||||
|
|
14
Jenkinsfile2
14
Jenkinsfile2
|
@ -151,14 +151,6 @@ def pre_test(){
|
|||
cd ${WKC}
|
||||
git submodule update --init --recursive
|
||||
'''
|
||||
sh '''
|
||||
cd ${WKPY}
|
||||
git reset --hard
|
||||
git pull
|
||||
git log -5
|
||||
echo "python connector log: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
echo >>${WKDIR}/jenkins.log
|
||||
'''
|
||||
return 1
|
||||
}
|
||||
def pre_test_build_mac() {
|
||||
|
@ -363,7 +355,7 @@ pipeline {
|
|||
}
|
||||
parallel {
|
||||
stage('check docs') {
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_52 || worker03 || slave215 || slave217 || slave219 || Mac_catalina "}
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_50 || slave1_52 || slave1_59 || slave1_63 || worker03 || slave215 || slave217 || slave219 || Mac_catalina "}
|
||||
steps {
|
||||
check_docs()
|
||||
}
|
||||
|
@ -401,7 +393,7 @@ pipeline {
|
|||
agent{label " Mac_catalina "}
|
||||
steps {
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
timeout(time: 20, unit: 'MINUTES'){
|
||||
timeout(time: 30, unit: 'MINUTES'){
|
||||
pre_test()
|
||||
pre_test_build_mac()
|
||||
}
|
||||
|
@ -409,7 +401,7 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('linux test') {
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_52 || worker03 || slave215 || slave217 || slave219 "}
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_50 || slave1_52 || slave1_59 || slave1_63 || worker03 || slave215 || slave217 || slave219 "}
|
||||
options { skipDefaultCheckout() }
|
||||
when {
|
||||
changeRequest()
|
||||
|
|
|
@ -45,7 +45,7 @@ TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。
|
|||
|
||||
TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。默认 TDengine 编译不包含 taosTools, 您可以在编译 TDengine 时使用`cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。
|
||||
|
||||
为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.0.2 或者更高版本。
|
||||
为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.13.0 或者更高版本。
|
||||
|
||||
## 安装工具
|
||||
|
||||
|
@ -124,7 +124,7 @@ brew install argp-standalone gflags pkgconfig
|
|||
|
||||
TDengine 包含数个使用 Go 语言开发的组件,比如taosAdapter, 请参考 golang.org 官方文档设置 go 开发环境。
|
||||
|
||||
请使用 1.14 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。
|
||||
请使用 1.20 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
|
|
|
@ -53,7 +53,7 @@ You can choose to install through source code, [container](https://docs.tdengine
|
|||
|
||||
TDengine provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. By default, TDengine compiling does not include taosTools. You can use `cmake .. -DBUILD_TOOLS=true` to make them be compiled with TDengine.
|
||||
|
||||
To build TDengine, use [CMake](https://cmake.org/) 3.0.2 or higher versions in the project directory.
|
||||
To build TDengine, use [CMake](https://cmake.org/) 3.13.0 or higher versions in the project directory.
|
||||
|
||||
## Install build tools
|
||||
|
||||
|
@ -131,7 +131,7 @@ brew install argp-standalone gflags pkgconfig
|
|||
|
||||
TDengine includes a few components like taosAdapter developed by Go language. Please refer to golang.org official documentation for golang environment setup.
|
||||
|
||||
Please use version 1.14+. For the user in China, we recommend using a proxy to accelerate package downloading.
|
||||
Please use version 1.20+. For the user in China, we recommend using a proxy to accelerate package downloading.
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
# bdb
|
||||
ExternalProject_Add(bdb
|
||||
GIT_REPOSITORY https://github.com/berkeleydb/libdb.git
|
||||
GIT_TAG v5.3.28
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/bdb"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/bdb"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND COMMAND ./dist/configure --enable-debug
|
||||
BUILD_COMMAND "$(MAKE)"
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -97,7 +97,15 @@ ENDIF()
|
|||
SET(JEMALLOC_ENABLED OFF)
|
||||
IF (TD_WINDOWS)
|
||||
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
||||
IF (${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||
MESSAGE("${Green} will build Release version! ${ColourReset}")
|
||||
SET(COMMON_FLAGS "/W3 /D_WIN32 /DWIN32 /Zi- /O2 /GL /MD")
|
||||
|
||||
ELSE ()
|
||||
MESSAGE("${Green} will build Debug version! ${ColourReset}")
|
||||
SET(COMMON_FLAGS "/w /D_WIN32 /DWIN32 /Zi /MTd")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
# IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
|
||||
# SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
|
||||
|
@ -149,6 +157,9 @@ ELSE ()
|
|||
CHECK_C_COMPILER_FLAG("-mfma" COMPILER_SUPPORT_FMA)
|
||||
CHECK_C_COMPILER_FLAG("-mavx" COMPILER_SUPPORT_AVX)
|
||||
CHECK_C_COMPILER_FLAG("-mavx2" COMPILER_SUPPORT_AVX2)
|
||||
CHECK_C_COMPILER_FLAG("-mavx512f" COMPILER_SUPPORT_AVX512F)
|
||||
CHECK_C_COMPILER_FLAG("-mavx512vbmi" COMPILER_SUPPORT_AVX512BMI)
|
||||
CHECK_C_COMPILER_FLAG("-mavx512vl" COMPILER_SUPPORT_AVX512VL)
|
||||
|
||||
IF (COMPILER_SUPPORT_SSE42)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2")
|
||||
|
@ -169,6 +180,18 @@ ELSE ()
|
|||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "SIMD instructions (FMA/AVX/AVX2) is ACTIVATED")
|
||||
|
||||
# IF (COMPILER_SUPPORT_AVX512F AND COMPILER_SUPPORT_AVX512BMI)
|
||||
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512vbmi")
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512vbmi")
|
||||
# MESSAGE(STATUS "avx512f/avx512bmi supported by compiler")
|
||||
# ENDIF()
|
||||
#
|
||||
# IF (COMPILER_SUPPORT_AVX512VL)
|
||||
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512vl")
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512vl")
|
||||
# MESSAGE(STATUS "avx512vl supported by compiler")
|
||||
# ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# build mode
|
||||
|
|
|
@ -151,6 +151,7 @@ IF(${BUILD_S3})
|
|||
|
||||
IF(${BUILD_WITH_S3})
|
||||
|
||||
add_definitions(-DUSE_S3)
|
||||
option(BUILD_WITH_COS "If build with cos" OFF)
|
||||
|
||||
ELSE ()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
IF (DEFINED VERNUMBER)
|
||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||
ELSE ()
|
||||
SET(TD_VER_NUMBER "3.2.1.0.alpha")
|
||||
SET(TD_VER_NUMBER "3.2.3.0.alpha")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERCOMPATIBLE)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# curl
|
||||
ExternalProject_Add(curl2
|
||||
URL https://curl.se/download/curl-8.2.1.tar.gz
|
||||
URL https://github.com/curl/curl/releases/download/curl-8_2_1/curl-8.2.1.tar.gz
|
||||
#URL https://curl.se/download/curl-8.2.1.tar.gz
|
||||
URL_HASH MD5=b25588a43556068be05e1624e0e74d41
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
# leveldb
|
||||
ExternalProject_Add(leveldb
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/leveldb.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/leveldb"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
# lucene
|
||||
ExternalProject_Add(lucene
|
||||
GIT_REPOSITORY https://github.com/yihaoDeng/LucenePlusPlus.git
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/lucene"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
# NuRaft
|
||||
ExternalProject_Add(NuRaft
|
||||
GIT_REPOSITORY https://github.com/eBay/NuRaft.git
|
||||
GIT_TAG v1.3.0
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/nuraft"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/nuraft"
|
||||
CONFIGURE_COMMAND "./prepare.sh"
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -2,7 +2,7 @@
|
|||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -13,6 +13,6 @@ ExternalProject_Add(xml2
|
|||
BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.2 --enable-shared=no --enable-static=yes --without-python --without-lzma
|
||||
BUILD_COMMAND make -j
|
||||
INSTALL_COMMAND make install && ln -s $ENV{HOME}/.cos-local.2/include/libxml2/libxml $ENV{HOME}/.cos-local.2/include/libxml
|
||||
INSTALL_COMMAND make install && ln -sf $ENV{HOME}/.cos-local.2/include/libxml2/libxml $ENV{HOME}/.cos-local.2/include/libxml
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
|
|
@ -109,11 +109,6 @@ cat("${TD_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
|||
# cJson
|
||||
cat("${TD_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# leveldb
|
||||
if(${BUILD_WITH_LEVELDB})
|
||||
cat("${TD_SUPPORT_DIR}/leveldb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_LEVELDB})
|
||||
|
||||
if (${BUILD_CONTRIB})
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
cat("${TD_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
@ -132,28 +127,11 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# canonical-raft
|
||||
if(${BUILD_WITH_CRAFT})
|
||||
cat("${TD_SUPPORT_DIR}/craft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
SET(BUILD_WITH_UV ON CACHE BOOL "craft need libuv" FORCE)
|
||||
endif(${BUILD_WITH_CRAFT})
|
||||
|
||||
# traft
|
||||
if(${BUILD_WITH_TRAFT})
|
||||
cat("${TD_SUPPORT_DIR}/traft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
SET(BUILD_WITH_UV ON CACHE BOOL "traft need libuv" FORCE)
|
||||
endif(${BUILD_WITH_TRAFT})
|
||||
|
||||
#libuv
|
||||
if(${BUILD_WITH_UV})
|
||||
cat("${TD_SUPPORT_DIR}/libuv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_UV})
|
||||
|
||||
# bdb
|
||||
if(${BUILD_WITH_BDB})
|
||||
cat("${TD_SUPPORT_DIR}/bdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_BDB})
|
||||
|
||||
# sqlite
|
||||
if(${BUILD_WITH_SQLITE})
|
||||
cat("${TD_SUPPORT_DIR}/sqlite_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
@ -178,17 +156,6 @@ elseif(${BUILD_WITH_COS})
|
|||
|
||||
endif()
|
||||
|
||||
# lucene
|
||||
if(${BUILD_WITH_LUCENE})
|
||||
cat("${TD_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_LUCENE)
|
||||
endif(${BUILD_WITH_LUCENE})
|
||||
|
||||
# NuRaft
|
||||
if(${BUILD_WITH_NURAFT})
|
||||
cat("${TD_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_NURAFT})
|
||||
|
||||
# crashdump
|
||||
if(${BUILD_CRASHDUMP})
|
||||
cat("${TD_SUPPORT_DIR}/crashdump_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
@ -317,7 +284,8 @@ if (${BUILD_WITH_ROCKSDB})
|
|||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
endif(${TD_LINUX})
|
||||
MESSAGE(STATUS "CXXXX STATUS CONFIG: " ${CMAKE_CXX_FLAGS})
|
||||
MESSAGE(STATUS "ROCKSDB CXXXX STATUS CONFIG: " ${CMAKE_CXX_FLAGS})
|
||||
MESSAGE(STATUS "ROCKSDB C STATUS CONFIG: " ${CMAKE_C_FLAGS})
|
||||
|
||||
if(${TD_DARWIN})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=maybe-uninitialized")
|
||||
|
@ -329,8 +297,12 @@ if (${BUILD_WITH_ROCKSDB})
|
|||
|
||||
if (${TD_WINDOWS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
||||
option(WITH_JNI "" OFF)
|
||||
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
||||
message("Rocksdb build runtime lib use /MT or /MTd")
|
||||
option(WITH_MD_LIBRARY "build with MD" OFF)
|
||||
endif()
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib)
|
||||
endif(${TD_WINDOWS})
|
||||
|
||||
|
@ -361,9 +333,11 @@ if (${BUILD_WITH_ROCKSDB})
|
|||
)
|
||||
else()
|
||||
if (NOT ${TD_LINUX})
|
||||
MESSAGE(STATUS "CXXXX STATUS CONFIG: " ${CMAKE_CXX_FLAGS})
|
||||
MESSAGE(STATUS "ROCKSDB CXX STATUS CONFIG: " ${CMAKE_CXX_FLAGS})
|
||||
MESSAGE(STATUS "ROCKSDB C STATUS CONFIG: " ${CMAKE_C_FLAGS})
|
||||
if(${TD_DARWIN})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=maybe-uninitialized")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=maybe-uninitialized")
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
if (${TD_DARWIN_ARM64})
|
||||
|
@ -372,8 +346,12 @@ if (${BUILD_WITH_ROCKSDB})
|
|||
|
||||
if (${TD_WINDOWS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
||||
option(WITH_JNI "" OFF)
|
||||
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
||||
message("Rocksdb build runtime lib use /MT or /MTd")
|
||||
option(WITH_MD_LIBRARY "build with MD" OFF)
|
||||
endif()
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib)
|
||||
endif(${TD_WINDOWS})
|
||||
|
||||
|
@ -437,26 +415,11 @@ elseif(${BUILD_WITH_COS})
|
|||
|
||||
endif()
|
||||
|
||||
# lucene
|
||||
# To support build on ubuntu: sudo apt-get install libboost-all-dev
|
||||
if(${BUILD_WITH_LUCENE})
|
||||
option(ENABLE_TEST "Enable the tests" OFF)
|
||||
add_subdirectory(lucene EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
lucene++
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lucene/include>
|
||||
)
|
||||
|
||||
endif(${BUILD_WITH_LUCENE})
|
||||
|
||||
# NuRaft
|
||||
if(${BUILD_WITH_NURAFT})
|
||||
add_subdirectory(nuraft EXCLUDE_FROM_ALL)
|
||||
endif(${BUILD_WITH_NURAFT})
|
||||
|
||||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
set(CMAKE_BUILD_TYPE debug)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
add_definitions(-DPTW32_STATIC_LIB)
|
||||
add_subdirectory(pthread EXCLUDE_FROM_ALL)
|
||||
set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread)
|
||||
|
@ -524,30 +487,6 @@ if(${BUILD_WCWIDTH})
|
|||
SET_TARGET_PROPERTIES(wcwidth PROPERTIES OUTPUT_NAME wcwidth)
|
||||
endif(${BUILD_WCWIDTH})
|
||||
|
||||
# CRAFT
|
||||
if(${BUILD_WITH_CRAFT})
|
||||
add_library(craft STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(craft PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/craft/.libs/libraft.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/craft/include"
|
||||
)
|
||||
# target_link_libraries(craft
|
||||
# INTERFACE pthread
|
||||
# )
|
||||
endif(${BUILD_WITH_CRAFT})
|
||||
|
||||
# TRAFT
|
||||
if(${BUILD_WITH_TRAFT})
|
||||
add_library(traft STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(traft PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/traft/.libs/libraft.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/traft/include"
|
||||
)
|
||||
# target_link_libraries(craft
|
||||
# INTERFACE pthread
|
||||
# )
|
||||
endif(${BUILD_WITH_TRAFT})
|
||||
|
||||
# LIBUV
|
||||
if(${BUILD_WITH_UV})
|
||||
if (TD_WINDOWS)
|
||||
|
@ -559,18 +498,6 @@ if(${BUILD_WITH_UV})
|
|||
add_subdirectory(libuv EXCLUDE_FROM_ALL)
|
||||
endif(${BUILD_WITH_UV})
|
||||
|
||||
# BDB
|
||||
if(${BUILD_WITH_BDB})
|
||||
add_library(bdb STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(bdb PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/bdb/libdb.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/bdb"
|
||||
)
|
||||
target_link_libraries(bdb
|
||||
INTERFACE pthread
|
||||
)
|
||||
endif(${BUILD_WITH_BDB})
|
||||
|
||||
# SQLite
|
||||
# see https://stackoverflow.com/questions/8774593/cmake-link-to-external-library#comment58570736_10550334
|
||||
if(${BUILD_WITH_SQLITE})
|
||||
|
@ -640,13 +567,18 @@ if(${BUILD_GEOS})
|
|||
if(${TD_LINUX})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_REL}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_REL}")
|
||||
IF ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
endif(${TD_LINUX})
|
||||
option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" OFF)
|
||||
add_subdirectory(geos EXCLUDE_FROM_ALL)
|
||||
if (${TD_WINDOWS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
else ()
|
||||
unset(CMAKE_CXX_STANDARD CACHE) # undo libgeos's setting of global CMAKE_CXX_STANDARD
|
||||
endif(${TD_WINDOWS})
|
||||
target_include_directories(
|
||||
geos_c
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/geos/include>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -19,7 +19,9 @@ TDengine uses ubiquitous SQL as its query language, which greatly reduces learni
|
|||
|
||||
If you are a system administrator who cares about installation, upgrade, fault tolerance, disaster recovery, data import, data export, system configuration, how to monitor whether TDengine is running healthily, and how to improve system performance, please refer to, and thoroughly read the [Administration](./operation) section.
|
||||
|
||||
If you want to know more about TDengine tools, the REST API, and connectors for various programming languages, please see the [Reference](./reference) chapter.
|
||||
If you want to know more about TDengine tools and the REST API, please see the [Reference](./reference) chapter.
|
||||
|
||||
For information about connecting to TDengine with different programming languages, see [Client Libraries](./client-libraries/).
|
||||
|
||||
If you are very interested in the internal design of TDengine, please read the chapter [Inside TDengine](./tdinternal), which introduces the cluster design, data partitioning, sharding, writing, and reading processes in detail. If you want to study TDengine code or even contribute code, please read this chapter carefully.
|
||||
|
||||
|
|
|
@ -37,27 +37,26 @@ The major features are listed below:
|
|||
- Provides an interactive [Command Line Interface (CLI)](../reference/taos-shell) for management, maintenance and ad-hoc queries.
|
||||
- Provides a tool [taosBenchmark](../reference/taosbenchmark/) for testing the performance of TDengine.
|
||||
10. Programming
|
||||
- Provides [connectors](../reference/connector/) for [C/C++](../reference/connector/cpp), [Java](../reference/connector/java), [Python](../reference/connector/python), [Go](../reference/connector/go), [Rust](../reference/connector/rust), [Node.js](../reference/connector/node) and other programming languages.
|
||||
- Provides [client libraries](../client-libraries/) for [C/C++](../client-libraries/cpp), [Java](../client-libraries/java), [Python](../client-libraries/python), [Go](../client-libraries/go), [Rust](../client-libraries/rust), [Node.js](../client-libraries/node) and other programming languages.
|
||||
- Provides a [REST API](../reference/rest-api/).
|
||||
|
||||
For more details on features, please read through the entire documentation.
|
||||
|
||||
## Competitive Advantages
|
||||
|
||||
By making full use of [characteristics of time series data](https://tdengine.com/tsdb/characteristics-of-time-series-data/), TDengine differentiates itself from other [time series databases](https://tdengine.com/tsdb/), with the following advantages.
|
||||
By making full use of [characteristics of time series data](https://tdengine.com/characteristics-of-time-series-data/), TDengine differentiates itself from other time series databases with the following advantages.
|
||||
|
||||
- **[High-Performance](https://tdengine.com/tdengine/high-performance-time-series-database/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
|
||||
- **[High-Performance](https://tdengine.com/high-performance/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
|
||||
|
||||
- **[Simplified Solution](https://tdengine.com/tdengine/simplified-time-series-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
|
||||
- **[Simplified Solution](https://tdengine.com/comprehensive-industrial-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
|
||||
|
||||
- **[Cloud Native](https://tdengine.com/tdengine/cloud-native-time-series-database/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for Kubernetes deployment and full observability, TDengine is a cloud native Time-series Database and can be deployed on public, private or hybrid clouds.
|
||||
- **[Cloud Native](https://tdengine.com/cloud-native/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for Kubernetes deployment and full observability, TDengine is a cloud native Time-series Database and can be deployed on public, private or hybrid clouds.
|
||||
|
||||
- **[Ease of Use](https://tdengine.com/tdengine/easy-time-series-data-platform/)**: For administrators, TDengine significantly reduces the effort to[
|
||||
](https://tdengine.com/tdengine/easy-time-series-data-platform/) deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
|
||||
- **[Ease of Use](https://tdengine.com/easy-to-use/)**: For administrators, TDengine significantly reduces the effort to deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
|
||||
|
||||
- **[Easy Data Analytics](https://tdengine.com/tdengine/time-series-data-analytics-made-easy/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
|
||||
- **[Easy Data Analytics](https://tdengine.com/simplifying-time-series-analysis-for-data-scientists/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
|
||||
|
||||
- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine's core modules, including cluster feature, are all available under open source licenses. It has gathered over 19k stars on GitHub. There is an active developer community, and over 140k running instances worldwide.
|
||||
- **[Open Source](https://tdengine.com/open-source/)**: TDengine's core modules, including cluster feature, are all available under open source licenses. It has gathered over 22k stars on GitHub. There is an active developer community, and over 400k running instances worldwide.
|
||||
|
||||
With TDengine, the total cost of ownership of your time-series data platform can be greatly reduced.
|
||||
|
||||
|
@ -125,16 +124,9 @@ As a high-performance, scalable and SQL supported time-series database, TDengine
|
|||
|
||||
- [TDengine vs. InfluxDB](https://tdengine.com/tsdb-comparison-influxdb-vs-tdengine/)
|
||||
- [TDengine vs. TimescaleDB](https://tdengine.com/tsdb-comparison-timescaledb-vs-tdengine/)
|
||||
- [TDengine vs. OpenTSDB](https://tdengine.com/performance-tdengine-vs-opentsdb/)
|
||||
- [TDengine vs. Cassandra](https://tdengine.com/performance-tdengine-vs-cassandra/)
|
||||
|
||||
## More readings
|
||||
- [Introduction to Time-Series Database](https://tdengine.com/tsdb/)
|
||||
- [Introduction to TDengine competitive advantages](https://tdengine.com/tdengine/)
|
||||
|
||||
|
||||
## Products
|
||||
|
||||
There are two products offered by TDengine: TDengine Enterprise and TDengine Cloud, for details please refer to
|
||||
- [TDengine Enterprise](https://www.taosdata.com/tdengine-pro)
|
||||
- [TDengine Cloud](https://cloud.taosdata.com/?utm_source=menu&utm_medium=webcn)
|
||||
For information about our paid offerings, see:
|
||||
- [TDengine Enterprise](https://tdengine.com/enterprise/)
|
||||
- [TDengine Cloud](https://cloud.tdengine.com)
|
|
@ -30,7 +30,7 @@ And then run the following command:
|
|||
docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine
|
||||
```
|
||||
|
||||
Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connectors. You can open these ports as needed.
|
||||
Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connections. You can open these ports as needed.
|
||||
|
||||
If you need to persist data to a specific directory on your local machine, please run the following command:
|
||||
```shell
|
||||
|
|
|
@ -14,9 +14,9 @@ This document describes how to install TDengine on Linux/Windows/macOS and perfo
|
|||
- To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker).
|
||||
- If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine).
|
||||
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to client libraries for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
|
||||
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ connector.
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ client library.
|
||||
|
||||
TDengine OSS is released as Deb and RPM packages. The Deb package can be installed on Debian, Ubuntu, and derivative systems. The RPM package can be installed on CentOS, RHEL, SUSE, and derivative systems. A .tar.gz package is also provided for enterprise customers, and you can install TDengine over `apt-get` as well. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the Deb or RPM package, download and install taosTools separately. TDengine can also be installed on x64 Windows and x64/m1 macOS.
|
||||
|
||||
|
@ -243,7 +243,7 @@ You can use the TDengine CLI to monitor your TDengine deployment and execute ad
|
|||
taos
|
||||
```
|
||||
|
||||
The TDengine CLI displays a welcome message and version information to indicate that its connection to the TDengine service was successful. If an error message is displayed, see the [FAQ](/train-faq/faq) for troubleshooting information. At the following prompt, you can execute SQL commands.
|
||||
The TDengine CLI displays a welcome message and version information to indicate that its connection to the TDengine service was successful. If an error message is displayed, see the [FAQ](../../train-faq/faq) for troubleshooting information. At the following prompt, you can execute SQL commands.
|
||||
|
||||
```cmd
|
||||
taos>
|
||||
|
|
|
@ -2,7 +2,7 @@ import PkgList from "/components/PkgList";
|
|||
|
||||
TDengine is easy to download and install.
|
||||
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ connector.
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ client library.
|
||||
|
||||
You can download the TDengine installation package in .rpm, .deb, or .tar.gz format. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the .deb or .rpm package, download and install taosTools separately.
|
||||
|
||||
|
@ -10,7 +10,7 @@ Between official releases, beta versions may be released that contain new featur
|
|||
|
||||
<PkgList type={0}/>
|
||||
|
||||
For information about installing TDengine, see [Install and Uninstall](/operation/pkg-install).
|
||||
For information about installing TDengine, see [Install and Uninstall](../operation/pkg-install).
|
||||
|
||||
For information about TDengine releases, see [All Downloads](https://tdengine.com/all-downloads)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import StackOverflowSVG from './stackoverflow.svg'
|
|||
|
||||
You can install and run TDengine on Linux/Windows/macOS machines as well as Docker containers. You can also deploy TDengine as a managed service with TDengine Cloud.
|
||||
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to connectors for multiple languages, TDengine also provides a [RESTful interface](/reference/rest-api) through [taosAdapter](/reference/taosadapter).
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to client libraries for multiple languages, TDengine also provides a [RESTful interface](../reference/rest-api) through [taosAdapter](../reference/taosadapter).
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
|
|
@ -12,4 +12,4 @@ When using REST connection, the feature of bulk pulling can be enabled if the si
|
|||
{{#include docs/examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}}
|
||||
```
|
||||
|
||||
More configuration about connection, please refer to [Java Connector](/reference/connector/java)
|
||||
More configuration about connection, please refer to [Java Client Library](../../client-libraries/java)
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
```
|
||||
|
||||
:::note
|
||||
For Rust connector, the connection depends on the feature being used. If "rest" feature is enabled, then only the implementation for "rest" is compiled and packaged.
|
||||
For Rust client library, the connection depends on the feature being used. If "rest" feature is enabled, then only the implementation for "rest" is compiled and packaged.
|
||||
|
||||
:::
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Connect to TDengine
|
||||
sidebar_label: Connect
|
||||
description: This document describes how to establish connections to TDengine and how to install and use TDengine connectors.
|
||||
description: This document describes how to establish connections to TDengine and how to install and use TDengine client libraries.
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
|
@ -15,28 +15,28 @@ import ConnCSNative from "./_connect_cs.mdx";
|
|||
import ConnC from "./_connect_c.mdx";
|
||||
import ConnR from "./_connect_r.mdx";
|
||||
import ConnPHP from "./_connect_php.mdx";
|
||||
import InstallOnLinux from "../../14-reference/03-connector/_linux_install.mdx";
|
||||
import InstallOnWindows from "../../14-reference/03-connector/_windows_install.mdx";
|
||||
import InstallOnMacOS from "../../14-reference/03-connector/_macos_install.mdx";
|
||||
import VerifyLinux from "../../14-reference/03-connector/_verify_linux.mdx";
|
||||
import VerifyWindows from "../../14-reference/03-connector/_verify_windows.mdx";
|
||||
import VerifyMacOS from "../../14-reference/03-connector/_verify_macos.mdx";
|
||||
import InstallOnLinux from "../../08-client-libraries/_linux_install.mdx";
|
||||
import InstallOnWindows from "../../08-client-libraries/_windows_install.mdx";
|
||||
import InstallOnMacOS from "../../08-client-libraries/_macos_install.mdx";
|
||||
import VerifyLinux from "../../08-client-libraries/_verify_linux.mdx";
|
||||
import VerifyWindows from "../../08-client-libraries/_verify_windows.mdx";
|
||||
import VerifyMacOS from "../../08-client-libraries/_verify_macos.mdx";
|
||||
|
||||
Any application running on any platform can access TDengine through the REST API provided by TDengine. For information, see [REST API](/reference/rest-api/). Applications can also use the connectors for various programming languages, including C/C++, Java, Python, Go, Node.js, C#, and Rust, to access TDengine. These connectors support connecting to TDengine clusters using both native interfaces (taosc). Some connectors also support connecting over a REST interface. Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector.
|
||||
Any application running on any platform can access TDengine through the REST API provided by TDengine. For information, see [REST API](../../reference/rest-api/). Applications can also use the client libraries for various programming languages, including C/C++, Java, Python, Go, Node.js, C#, and Rust, to access TDengine. These client libraries support connecting to TDengine clusters using both native interfaces (taosc). Some client libraries also support connecting over a REST interface. Community developers have also contributed several unofficial client libraries, such as the ADO.NET, Lua, and PHP libraries.
|
||||
|
||||
## Establish Connection
|
||||
|
||||
There are two ways for a connector to establish connections to TDengine:
|
||||
There are two ways for a client library to establish connections to TDengine:
|
||||
|
||||
1. REST connection through the REST API provided by the taosAdapter component.
|
||||
2. Native connection through the TDengine client driver (taosc).
|
||||
|
||||
For REST and native connections, connectors provide similar APIs for performing operations and running SQL statements on your databases. The main difference is the method of establishing the connection, which is not visible to users.
|
||||
For REST and native connections, client libraries provide similar APIs for performing operations and running SQL statements on your databases. The main difference is the method of establishing the connection, which is not visible to users.
|
||||
|
||||
Key differences:
|
||||
|
||||
3. The REST connection is more accessible with cross-platform support, however it results in a 30% performance downgrade.
|
||||
1. The TDengine client driver (taosc) has the highest performance with all the features of TDengine like [Parameter Binding](/reference/connector/cpp#parameter-binding-api), [Subscription](/reference/connector/cpp#subscription-and-consumption-api), etc.
|
||||
1. The TDengine client driver (taosc) has the highest performance with all the features of TDengine like [Parameter Binding](../../client-libraries/cpp#parameter-binding-api), [Subscription](../../client-libraries/cpp#subscription-and-consumption-api), etc.
|
||||
|
||||
## Install Client Driver taosc
|
||||
|
||||
|
@ -72,7 +72,7 @@ After the above installation and configuration are done and making sure TDengine
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Install Connectors
|
||||
## Install Client Library
|
||||
|
||||
<Tabs groupId="lang">
|
||||
<TabItem label="Java" value="java">
|
||||
|
@ -131,7 +131,7 @@ libtaos = { version = "0.4.2"}
|
|||
```
|
||||
|
||||
:::info
|
||||
Rust connector uses different features to distinguish the way to establish connection. To establish REST connection, please enable `rest` feature.
|
||||
Rust client library uses different features to distinguish the way to establish connection. To establish REST connection, please enable `rest` feature.
|
||||
|
||||
```toml
|
||||
libtaos = { version = "*", features = ["rest"] }
|
||||
|
@ -142,9 +142,9 @@ libtaos = { version = "*", features = ["rest"] }
|
|||
</TabItem>
|
||||
<TabItem label="Node.js" value="node">
|
||||
|
||||
Node.js connector provides different ways of establishing connections by providing different packages.
|
||||
Node.js client library provides different ways of establishing connections by providing different packages.
|
||||
|
||||
1. Install Node.js Native Connector
|
||||
1. Install Node.js Native Client Library
|
||||
|
||||
```
|
||||
npm install @tdengine/client
|
||||
|
@ -154,7 +154,7 @@ npm install @tdengine/client
|
|||
It's recommend to use Node whose version is between `node-v12.8.0` and `node-v13.0.0`.
|
||||
:::
|
||||
|
||||
2. Install Node.js REST Connector
|
||||
2. Install Node.js REST Client Library
|
||||
|
||||
```
|
||||
npm install @tdengine/rest
|
||||
|
@ -177,7 +177,7 @@ Just need to add the reference to [TDengine.Connector](https://www.nuget.org/pac
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.0" />
|
||||
<PackageReference Include="TDengine.Connector" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -207,7 +207,7 @@ install.packages("RJDBC")
|
|||
</TabItem>
|
||||
<TabItem label="C" value="c">
|
||||
|
||||
If the client driver (taosc) is already installed, then the C connector is already available.
|
||||
If the client driver (taosc) is already installed, then the C client library is already available.
|
||||
<br/>
|
||||
|
||||
</TabItem>
|
||||
|
|
|
@ -3,9 +3,9 @@ title: Data Model
|
|||
description: This document describes the data model of TDengine.
|
||||
---
|
||||
|
||||
The data model employed by TDengine is similar to that of a relational database. You have to create databases and tables. You must design the data model based on your own business and application requirements. You should design the [STable](/concept/#super-table-stable) (an abbreviation for super table) schema to fit your data. This chapter will explain the big picture without getting into syntactical details.
|
||||
The data model employed by TDengine is similar to that of a relational database. You have to create databases and tables. You must design the data model based on your own business and application requirements. You should design the [STable](../../concept/#super-table-stable) (an abbreviation for super table) schema to fit your data. This chapter will explain the big picture without getting into syntactical details.
|
||||
|
||||
Note: before you read this chapter, please make sure you have already read through [Key Concepts](/concept/), since TDengine introduces new concepts like "one table for one [data collection point](/concept/#data-collection-point)" and "[super table](/concept/#super-table-stable)".
|
||||
Note: before you read this chapter, please make sure you have already read through [Key Concepts](../../concept/), since TDengine introduces new concepts like "one table for one [data collection point](../../concept/#data-collection-point)" and "[super table](../../concept/#super-table-stable)".
|
||||
|
||||
## Create Database
|
||||
|
||||
|
@ -22,7 +22,7 @@ In the above SQL statement:
|
|||
- a new data file will be created every 10 days
|
||||
- the size of the write cache pool on each VNode is 16 MB
|
||||
- the number of vgroups is 100
|
||||
- WAL is enabled but fsync is disabled For more details please refer to [Database](/taos-sql/database).
|
||||
- WAL is enabled but fsync is disabled For more details please refer to [Database](../../taos-sql/database).
|
||||
|
||||
After creating a database, the current database in use can be switched using SQL command `USE`. For example the SQL statement below switches the current database to `power`.
|
||||
|
||||
|
@ -41,13 +41,13 @@ Without the current database specified, table name must be preceded with the cor
|
|||
|
||||
## Create STable
|
||||
|
||||
In a time-series application, there may be multiple kinds of data collection points. For example, in the electrical power system there are meters, transformers, bus bars, switches, etc. For easy and efficient aggregation of multiple tables, one STable needs to be created for each kind of data collection point. For example, for the meters in [table 1](/concept/#model_table1), the SQL statement below can be used to create the super table.
|
||||
In a time-series application, there may be multiple kinds of data collection points. For example, in the electrical power system there are meters, transformers, bus bars, switches, etc. For easy and efficient aggregation of multiple tables, one STable needs to be created for each kind of data collection point. For example, for the meters in [table 1](../../concept/#model_table1), the SQL statement below can be used to create the super table.
|
||||
|
||||
```sql
|
||||
CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);
|
||||
```
|
||||
|
||||
Similar to creating a regular table, when creating a STable, the name and schema need to be provided. In the STable schema, the first column must always be a timestamp (like ts in the example), and the other columns (like current, voltage and phase in the example) are the data collected. The remaining columns can [contain data of type](/taos-sql/data-type/) integer, float, double, string etc. In addition, the schema for tags, like location and groupId in the example, must be provided. The tag type can be integer, float, string, etc. Tags are essentially the static properties of a data collection point. For example, properties like the location, device type, device group ID, manager ID are tags. Tags in the schema can be added, removed or updated. Please refer to [STable](/taos-sql/stable) for more details.
|
||||
Similar to creating a regular table, when creating a STable, the name and schema need to be provided. In the STable schema, the first column must always be a timestamp (like ts in the example), and the other columns (like current, voltage and phase in the example) are the data collected. The remaining columns can [contain data of type](../../taos-sql/data-type/) integer, float, double, string etc. In addition, the schema for tags, like location and groupId in the example, must be provided. The tag type can be integer, float, string, etc. Tags are essentially the static properties of a data collection point. For example, properties like the location, device type, device group ID, manager ID are tags. Tags in the schema can be added, removed or updated. Please refer to [STable](../../taos-sql/stable) for more details.
|
||||
|
||||
For each kind of data collection point, a corresponding STable must be created. There may be many STables in an application. For electrical power system, we need to create a STable respectively for meters, transformers, busbars, switches. There may be multiple kinds of data collection points on a single device, for example there may be one data collection point for electrical data like current and voltage and another data collection point for environmental data like temperature, humidity and wind direction. Multiple STables are required for these kinds of devices.
|
||||
|
||||
|
@ -61,7 +61,7 @@ A specific table needs to be created for each data collection point. Similar to
|
|||
CREATE TABLE d1001 USING meters TAGS ("California.SanFrancisco", 2);
|
||||
```
|
||||
|
||||
In the above SQL statement, "d1001" is the table name, "meters" is the STable name, followed by the value of tag "Location" and the value of tag "groupId", which are "California.SanFrancisco" and "2" respectively in the example. The tag values can be updated after the table is created. Please refer to [Tables](/taos-sql/table) for details.
|
||||
In the above SQL statement, "d1001" is the table name, "meters" is the STable name, followed by the value of tag "Location" and the value of tag "groupId", which are "California.SanFrancisco" and "2" respectively in the example. The tag values can be updated after the table is created. Please refer to [Tables](../../taos-sql/table) for details.
|
||||
|
||||
It's suggested to use the globally unique ID of a data collection point as the table name. For example the device serial number could be used as a unique ID. If a unique ID doesn't exist, multiple IDs that are not globally unique can be combined to form a globally unique ID. It's not recommended to use a globally unique ID as tag value.
|
||||
|
||||
|
@ -75,7 +75,7 @@ INSERT INTO d1001 USING meters TAGS ("California.SanFrancisco", 2) VALUES (now,
|
|||
|
||||
In the above SQL statement, a row with value `(now, 10.2, 219, 0.32)` will be inserted into table "d1001". If table "d1001" doesn't exist, it will be created automatically using STable "meters" as template with tag value `"California.SanFrancisco", 2`.
|
||||
|
||||
For more details please refer to [Create Table Automatically](/taos-sql/insert#automatically-create-table-when-inserting).
|
||||
For more details please refer to [Create Table Automatically](../../taos-sql/insert#automatically-create-table-when-inserting).
|
||||
|
||||
## Single Column vs Multiple Column
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import PhpStmt from "./_php_stmt.mdx";
|
|||
|
||||
## Introduction
|
||||
|
||||
Application programs can execute `INSERT` statement through connectors to insert rows. The TDengine CLI can also be used to manually insert data.
|
||||
Application programs can execute `INSERT` statement through client libraries to insert rows. The TDengine CLI can also be used to manually insert data.
|
||||
|
||||
### Insert Single Row
|
||||
The below SQL statement is used to insert one row into table "d1001".
|
||||
|
@ -33,7 +33,7 @@ The below SQL statement is used to insert one row into table "d1001".
|
|||
INSERT INTO d1001 VALUES (ts1, 10.3, 219, 0.31);
|
||||
```
|
||||
|
||||
`ts1` is Unix timestamp, the timestamps which is larger than the difference between current time and KEEP in config is only allowed. For further detail, refer to [TDengine SQL insert timestamp section](/taos-sql/insert).
|
||||
`ts1` is Unix timestamp, the timestamps which is larger than the difference between current time and KEEP in config is only allowed. For further detail, refer to [TDengine SQL insert timestamp section](../../../taos-sql/insert).
|
||||
|
||||
### Insert Multiple Rows
|
||||
|
||||
|
@ -43,7 +43,7 @@ Multiple rows can be inserted in a single SQL statement. The example below inser
|
|||
INSERT INTO d1001 VALUES (ts2, 10.2, 220, 0.23) (ts2, 10.3, 218, 0.25);
|
||||
```
|
||||
|
||||
`ts1` and `ts2` is Unix timestamp, the timestamps which is larger than the difference between current time and KEEP in config is only allowed. For further detail, refer to [TDengine SQL insert timestamp section](/taos-sql/insert).
|
||||
`ts1` and `ts2` is Unix timestamp, the timestamps which is larger than the difference between current time and KEEP in config is only allowed. For further detail, refer to [TDengine SQL insert timestamp section](../../../taos-sql/insert).
|
||||
|
||||
### Insert into Multiple Tables
|
||||
|
||||
|
@ -53,9 +53,9 @@ Data can be inserted into multiple tables in the same SQL statement. The example
|
|||
INSERT INTO d1001 VALUES (ts1, 10.3, 219, 0.31) (ts2, 12.6, 218, 0.33) d1002 VALUES (ts3, 12.3, 221, 0.31);
|
||||
```
|
||||
|
||||
`ts1`, `ts2` and `ts3` is Unix timestamp, the timestamps which is larger than the difference between current time and KEEP in config is only allowed. For further detail, refer to [TDengine SQL insert timestamp section](/taos-sql/insert).
|
||||
`ts1`, `ts2` and `ts3` is Unix timestamp, the timestamps which is larger than the difference between current time and KEEP in config is only allowed. For further detail, refer to [TDengine SQL insert timestamp section](../../../taos-sql/insert).
|
||||
|
||||
For more details about `INSERT` please refer to [INSERT](/taos-sql/insert).
|
||||
For more details about `INSERT` please refer to [INSERT](../../../taos-sql/insert).
|
||||
|
||||
:::info
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ bin/kafka-topics.sh --bootstrap-server=localhost:9092 --describe
|
|||
|
||||
## Insert into TDengine
|
||||
|
||||
We can write data into TDengine via SQL or Schemaless. For more information, please refer to [Insert Using SQL](/develop/insert-data/sql-writing/) or [High Performance Writing](/develop/insert-data/high-volume/) or [Schemaless Writing](/reference/schemaless/).
|
||||
We can write data into TDengine via SQL or Schemaless. For more information, please refer to [Insert Using SQL](../sql-writing/) or [High Performance Writing](../high-volume/) or [Schemaless Writing](../../../reference/schemaless/).
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0
|
|||
|
||||
:::
|
||||
|
||||
For more details please refer to [InfluxDB Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) and [TDengine Schemaless](/reference/schemaless/#Schemaless-Line-Protocol)
|
||||
For more details please refer to [InfluxDB Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) and [TDengine Schemaless](../../../reference/schemaless/#Schemaless-Line-Protocol)
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ SQLWriter class encapsulates the logic of composing SQL and writing data. Please
|
|||
|
||||
- TDengine client driver has been installed
|
||||
- Python3 has been installed, the the version >= 3.8
|
||||
- TDengine Python connector `taospy` has been installed
|
||||
- TDengine Python client library `taospy` has been installed
|
||||
|
||||
2. Install faster-fifo to replace python builtin multiprocessing.Queue
|
||||
|
||||
|
@ -434,7 +434,7 @@ SQLWriter class encapsulates the logic of composing SQL and writing data. Please
|
|||
</details>
|
||||
|
||||
:::note
|
||||
Don't establish connection to TDengine in the parent process if using Python connector in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue.
|
||||
Don't establish connection to TDengine in the parent process if using Python client library in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
```csharp
|
||||
{{#include docs/examples/csharp/asyncQuery/Program.cs}}
|
||||
```
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Query Data
|
||||
description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using connectors.
|
||||
description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using client libraries.
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
|
@ -15,12 +15,11 @@ import CQuery from "./_c.mdx";
|
|||
import PhpQuery from "./_php.mdx";
|
||||
import PyAsync from "./_py_async.mdx";
|
||||
import NodeAsync from "./_js_async.mdx";
|
||||
import CsAsync from "./_cs_async.mdx";
|
||||
import CAsync from "./_c_async.mdx";
|
||||
|
||||
## Introduction
|
||||
|
||||
SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or connectors. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine:
|
||||
SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or client libraries. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine:
|
||||
|
||||
- Query on single column or multiple columns
|
||||
- Filter on tags or data columns: >, <, =, <\>, like
|
||||
|
@ -128,7 +127,7 @@ For more information, see [Aggregate by Window](../../taos-sql/distinguished).
|
|||
|
||||
### Query
|
||||
|
||||
In the section describing [Insert](/develop/insert-data/sql-writing), a database named `power` is created and some data are inserted into STable `meters`. Below sample code demonstrates how to query the data in this STable.
|
||||
In the section describing [Insert](../insert-data/sql-writing), a database named `power` is created and some data are inserted into STable `meters`. Below sample code demonstrates how to query the data in this STable.
|
||||
|
||||
<Tabs defaultValue="java" groupId="lang">
|
||||
<TabItem label="Java" value="java">
|
||||
|
@ -174,9 +173,6 @@ Please note that async query can only be used with a native connection.
|
|||
<TabItem label="Python" value="python">
|
||||
<PyAsync />
|
||||
</TabItem>
|
||||
<TabItem label="C#" value="csharp">
|
||||
<CsAsync />
|
||||
</TabItem>
|
||||
<TabItem label="C" value="c">
|
||||
<CAsync />
|
||||
</TabItem>
|
||||
|
|
|
@ -23,7 +23,7 @@ By subscribing to a topic, a consumer can obtain the latest data in that topic i
|
|||
|
||||
To implement these features, TDengine indexes its write-ahead log (WAL) file for fast random access and provides configurable methods for replacing and retaining this file. You can define a retention period and size for this file. For information, see the CREATE DATABASE statement. In this way, the WAL file is transformed into a persistent storage engine that remembers the order in which events occur. However, note that configuring an overly long retention period for your WAL files makes database compression inefficient. TDengine then uses the WAL file instead of the time-series database as its storage engine for queries in the form of topics. TDengine reads the data from the WAL file; uses a unified query engine instance to perform filtering, transformations, and other operations; and finally pushes the data to consumers.
|
||||
|
||||
The following are some explanations about data subscription, which require some understanding of the architecture of TDengine and the use of various language linker interfaces.
|
||||
The following are some explanations about data subscription, which require some understanding of the architecture of TDengine and the use of various language linker interfaces(you can learn it when you need it).
|
||||
- A consumption group consumes all data under the same topic, and different consumption groups are independent of each other;
|
||||
- A consumption group consumes all vgroups of the same topic, which can be composed of multiple consumers, but a vgroup is only consumed by one consumer. If the number of consumers exceeds the number of vgroups, the excess consumers do not consume data;
|
||||
- On the server side, only one offset is saved for each vgroup, and the offsets for each vgroup are monotonically increasing, but not necessarily continuous. There is no correlation between the offsets of various vgroups;
|
||||
|
@ -45,12 +45,13 @@ The following are some explanations about data subscription, which require some
|
|||
|
||||
This document does not provide any further introduction to the knowledge of message queues themselves. If you need to know more, please search for it yourself.
|
||||
|
||||
Note:
|
||||
Starting from version 3.2.0.0, data subscription supports vnode migration and splitting.
|
||||
Due to the dependence of data subscription on wal files, wal does not synchronize during vnode migration and splitting. Therefore, after migration or splitting, wal data that has not been consumed before cannot be consumed. So please ensure that all data has been consumed before proceeding with vnode migration or splitting, otherwise data loss may occur during consumption.
|
||||
|
||||
## Data Schema and API
|
||||
|
||||
The related schemas and APIs in various languages are described as follows:
|
||||
The related schemas and APIs in various languages are described as follows(Note that the consumer structure is not thread safe. When using a consumer on one thread, do not close the consumer on another thread):
|
||||
|
||||
<Tabs defaultValue="java" groupId="lang">
|
||||
<TabItem value="c" label="C">
|
||||
|
@ -248,23 +249,23 @@ function close()
|
|||
<TabItem value="C#" label="C#">
|
||||
|
||||
```csharp
|
||||
class ConsumerBuilder<TValue>
|
||||
|
||||
ConsumerBuilder(IEnumerable<KeyValuePair<string, string>> config)
|
||||
|
||||
virtual IConsumer Build()
|
||||
|
||||
Consumer(ConsumerBuilder builder)
|
||||
public IConsumer<TValue> Build()
|
||||
|
||||
void Subscribe(IEnumerable<string> topics)
|
||||
|
||||
void Subscribe(string topic)
|
||||
|
||||
ConsumeResult Consume(int millisecondsTimeout)
|
||||
ConsumeResult<TValue> Consume(int millisecondsTimeout)
|
||||
|
||||
List<string> Subscription()
|
||||
|
||||
void Unsubscribe()
|
||||
|
||||
void Commit(ConsumeResult consumerResult)
|
||||
List<TopicPartitionOffset> Commit()
|
||||
|
||||
void Close()
|
||||
```
|
||||
|
@ -500,25 +501,19 @@ let consumer = taos.consumer({
|
|||
<TabItem value="C#" label="C#">
|
||||
|
||||
```csharp
|
||||
using TDengineTMQ;
|
||||
|
||||
// Create consumer groups on demand (GourpID) and enable automatic commits (EnableAutoCommit),
|
||||
// an automatic commit interval (AutoCommitIntervalMs), and a username (TDConnectUser) and password (TDConnectPasswd)
|
||||
var cfg = new ConsumerConfig
|
||||
var cfg = new Dictionary<string, string>()
|
||||
{
|
||||
EnableAutoCommit = "true"
|
||||
AutoCommitIntervalMs = "1000"
|
||||
GourpId = "TDengine-TMQ-C#",
|
||||
TDConnectUser = "root",
|
||||
TDConnectPasswd = "taosdata",
|
||||
AutoOffsetReset = "latest"
|
||||
MsgWithTableName = "true",
|
||||
TDConnectIp = "127.0.0.1",
|
||||
TDConnectPort = "6030"
|
||||
{ "group.id", "group1" },
|
||||
{ "auto.offset.reset", "latest" },
|
||||
{ "td.connect.ip", "127.0.0.1" },
|
||||
{ "td.connect.user", "root" },
|
||||
{ "td.connect.pass", "taosdata" },
|
||||
{ "td.connect.port", "6030" },
|
||||
{ "client.id", "tmq_example" },
|
||||
{ "enable.auto.commit", "true" },
|
||||
{ "msg.with.table.name", "false" },
|
||||
};
|
||||
|
||||
var consumer = new ConsumerBuilder(cfg).Build();
|
||||
|
||||
var consumer = new ConsumerBuilder<Dictionary<string, object>>(cfg).Build();
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
@ -747,10 +742,12 @@ while(true){
|
|||
## Consume data
|
||||
while (true)
|
||||
{
|
||||
var consumerRes = consumer.Consume(100);
|
||||
// process ConsumeResult
|
||||
ProcessMsg(consumerRes);
|
||||
consumer.Commit(consumerRes);
|
||||
using (var result = consumer.Consume(500))
|
||||
{
|
||||
if (result == null) continue;
|
||||
ProcessMsg(result);
|
||||
consumer.Commit();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ description: This document describes how to use the various components of TDengi
|
|||
|
||||
Before creating an application to process time-series data with TDengine, consider the following:
|
||||
|
||||
1. Choose the method to connect to TDengine. TDengine offers a REST API that can be used with any programming language. It also has connectors for a variety of languages.
|
||||
2. Design the data model based on your own use cases. Consider the main [concepts](/concept/) of TDengine, including "one table per data collection point" and the supertable. Learn about static labels, collected metrics, and subtables. Depending on the characteristics of your data and your requirements, you decide to create one or more databases and design a supertable schema that fit your data.
|
||||
1. Choose the method to connect to TDengine. TDengine offers a REST API that can be used with any programming language. It also has client libraries for a variety of languages.
|
||||
2. Design the data model based on your own use cases. Consider the main [concepts](../concept/) of TDengine, including "one table per data collection point" and the supertable. Learn about static labels, collected metrics, and subtables. Depending on the characteristics of your data and your requirements, you decide to create one or more databases and design a supertable schema that fit your data.
|
||||
3. Decide how you will insert data. TDengine supports writing using standard SQL, but also supports schemaless writing, so that data can be written directly without creating tables manually.
|
||||
4. Based on business requirements, find out what SQL query statements need to be written. You may be able to repurpose any existing SQL.
|
||||
5. If you want to run real-time analysis based on time series data, including various dashboards, use the TDengine stream processing component instead of deploying complex systems such as Spark or Flink.
|
||||
|
@ -14,7 +14,7 @@ Before creating an application to process time-series data with TDengine, consid
|
|||
7. In many use cases (such as fleet management), the application needs to obtain the latest status of each data collection point. It is recommended that you use the cache function of TDengine instead of deploying Redis separately.
|
||||
8. If you find that the SQL functions of TDengine cannot meet your requirements, then you can use user-defined functions to solve the problem.
|
||||
|
||||
This section is organized in the order described above. For ease of understanding, TDengine provides sample code for each supported programming language for each function. If you want to learn more about the use of SQL, please read the [SQL manual](/taos-sql/). For a more in-depth understanding of the use of each connector, please read the [Connector Reference Guide](/reference/connector/). If you also want to integrate TDengine with third-party systems, such as Grafana, please refer to the [third-party tools](/third-party/).
|
||||
This section is organized in the order described above. For ease of understanding, TDengine provides sample code for each supported programming language for each function. If you want to learn more about the use of SQL, please read the [SQL manual](../taos-sql/). For a more in-depth understanding of the use of each client library, please read the [Client Library Reference Guide](../client-libraries/). If you also want to integrate TDengine with third-party systems, such as Grafana, please refer to the [third-party tools](../third-party/).
|
||||
|
||||
If you encounter any problems during the development process, please click ["Submit an issue"](https://github.com/taosdata/TDengine/issues/new/choose) at the bottom of each page and submit it on GitHub right away.
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: C/C++ Connector
|
||||
title: C/C++ Client Library
|
||||
sidebar_label: C/C++
|
||||
description: This document describes the TDengine C/C++ connector.
|
||||
description: This document describes the TDengine C/C++ client library.
|
||||
---
|
||||
|
||||
C/C++ developers can use TDengine's client driver and the C/C++ connector, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ connector you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located.
|
||||
C/C++ developers can use TDengine's client driver and the C/C++ client library, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ client library you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located.
|
||||
|
||||
```c
|
||||
#include <taos.h>
|
||||
|
@ -24,7 +24,7 @@ The dynamic libraries for the TDengine client driver are located in.
|
|||
|
||||
## Supported platforms
|
||||
|
||||
Please refer to [list of supported platforms](/reference/connector#supported-platforms)
|
||||
Please refer to [list of supported platforms](../#supported-platforms)
|
||||
|
||||
## Supported versions
|
||||
|
||||
|
@ -32,7 +32,7 @@ The version number of the TDengine client driver and the version number of the T
|
|||
|
||||
## Installation Steps
|
||||
|
||||
Please refer to the [Installation Steps](/reference/connector#installation-steps) for TDengine client driver installation
|
||||
Please refer to the [Installation Steps](../#installation-steps) for TDengine client driver installation
|
||||
|
||||
## Establishing a connection
|
||||
|
||||
|
@ -263,7 +263,7 @@ typedef struct taosField {
|
|||
Get the reason for the last API call failure. The return value is the error code.
|
||||
|
||||
:::note
|
||||
TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C connector can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection.
|
||||
TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C client library can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -394,7 +394,7 @@ The specific functions related to the interface are as follows (see also the [pr
|
|||
|
||||
### Schemaless Writing API
|
||||
|
||||
In addition to writing data using the SQL method or the parameter binding API, writing can also be done using schemaless writing, which eliminates the need to create a super table/data sub-table structure in advance and writes the data directly. The TDengine system automatically creates and maintains the required table structure based on the written data content. The use of schemaless writing is described in the chapter [Schemaless Writing](/reference/schemaless/), and the C/C++ API used with it is described here.
|
||||
In addition to writing data using the SQL method or the parameter binding API, writing can also be done using schemaless writing, which eliminates the need to create a super table/data sub-table structure in advance and writes the data directly. The TDengine system automatically creates and maintains the required table structure based on the written data content. The use of schemaless writing is described in the chapter [Schemaless Writing](../../reference/schemaless/), and the C/C++ API used with it is described here.
|
||||
|
||||
- `TAOS_RES* taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, int precision)`
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
title: TDengine Java Connector
|
||||
title: TDengine Java Client Library
|
||||
sidebar_label: Java
|
||||
description: This document describes the TDengine Java Connector.
|
||||
description: This document describes the TDengine Java client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
`taos-jdbcdriver` is the official Java connector for TDengine. Java developers can use it to develop applications that access data in TDengine. `taos-jdbcdriver` implements standard JDBC driver interfaces and two connection methods: One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The second is **REST connection** which is implemented through taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
|
||||
`taos-jdbcdriver` is the official Java client library for TDengine. Java developers can use it to develop applications that access data in TDengine. `taos-jdbcdriver` implements standard JDBC driver interfaces and two connection methods: One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The second is **REST connection** which is implemented through taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
|
||||
|
||||

|
||||

|
||||
|
||||
The preceding figure shows the two ways in which a Java application can access TDengine.
|
||||
|
||||
|
@ -36,6 +36,7 @@ REST connection supports all platforms that can run Java.
|
|||
|
||||
| taos-jdbcdriver version | major changes | TDengine version |
|
||||
| :---------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------: |
|
||||
| 3.2.7 | Support VARBINARY and GEOMETRY types, and add time zone support for native connections. Support websocket auto reconnection | 3.2.0.0 or later |
|
||||
| 3.2.5 | Subscription add committed() and assignment() method | 3.1.0.3 or later |
|
||||
| 3.2.4 | Subscription add the enable.auto.commit parameter and the unsubscribe() method in the WebSocket connection | - |
|
||||
| 3.2.3 | Fixed resultSet data parsing failure in some cases | - |
|
||||
|
@ -71,7 +72,7 @@ try (Statement statement = connection.createStatement()) {
|
|||
}
|
||||
```
|
||||
|
||||
There are four types of error codes that the JDBC connector can report:
|
||||
There are four types of error codes that the JDBC client library can report:
|
||||
|
||||
- Error code of the JDBC driver itself (error code between 0x2301 and 0x2350),
|
||||
- Error code of the native connection method (error code between 0x2351 and 0x2360)
|
||||
|
@ -122,7 +123,7 @@ For specific error codes, please refer to.
|
|||
| 0x2379 | seek offset must not be a negative number | The seek interface parameter cannot be negative. Use the correct parameter |
|
||||
| 0x237a | vGroup not found in result set | subscription is not bound to the VGroup due to the rebalance mechanism |
|
||||
|
||||
- [TDengine Java Connector](https://github.com/taosdata/taos-connector-jdbc/blob/main/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java)
|
||||
- [TDengine Java client library](https://github.com/taosdata/taos-connector-jdbc/blob/main/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java)
|
||||
<!-- - [TDengine_ERROR_CODE](../error-code) -->
|
||||
|
||||
## TDengine DataType vs. Java DataType
|
||||
|
@ -147,21 +148,21 @@ TDengine currently supports timestamp, number, character, Boolean type, and the
|
|||
|
||||
**Note**: Only TAG supports JSON types
|
||||
Due to historical reasons, the BINARY type data in TDengine is not truly binary data and is no longer recommended for use. Please use VARBINARY type instead.
|
||||
GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type] (/tao-sql/data-type/#Data Types)
|
||||
For WKB specifications, please refer to [Well Known Binary (WKB)]( https://libgeos.org/specifications/wkb/ )
|
||||
For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java)
|
||||
GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type](../../taos-sql/data-type/)
|
||||
For WKB specifications, please refer to [Well Known Binary (WKB)](https://libgeos.org/specifications/wkb/)
|
||||
For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java)
|
||||
|
||||
|
||||
## Installation Steps
|
||||
|
||||
### Pre-installation preparation
|
||||
|
||||
Before using Java Connector to connect to the database, the following conditions are required.
|
||||
Before using Java client library to connect to the database, the following conditions are required.
|
||||
|
||||
- Java 1.8 or above runtime environment and Maven 3.6 or above installed
|
||||
- TDengine client driver installed (required for native connections, not required for REST connections), please refer to [Installing Client Driver](/reference/connector#Install-Client-Driver)
|
||||
- TDengine client driver installed (required for native connections, not required for REST connections), please refer to [Installing Client Driver](../#Install-Client-Driver)
|
||||
|
||||
### Install the connectors
|
||||
### Install the client library
|
||||
|
||||
<Tabs defaultValue="maven">
|
||||
<TabItem value="maven" label="Install via Maven">
|
||||
|
@ -178,14 +179,14 @@ Add following dependency in the `pom.xml` file of your Maven project:
|
|||
<dependency>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>3.2.7</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="source" label="Build from source code">
|
||||
|
||||
You can build Java connector from source code after cloning the TDengine project:
|
||||
You can build Java client library from source code after cloning the TDengine project:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/taosdata/taos-connector-jdbc.git
|
||||
|
@ -268,7 +269,7 @@ In the above example, JDBC uses the client's configuration file to establish a c
|
|||
|
||||
In TDengine, as long as one node in firstEp and secondEp is valid, the connection to the cluster can be established normally.
|
||||
|
||||
The configuration file here refers to the configuration file on the machine where the application that calls the JDBC Connector is located, the default path is `/etc/taos/taos.cfg` on Linux, the default path is `C://TDengine/cfg/taos.cfg` on Windows, and the default path is `/etc/taos/taos.cfg` on macOS.
|
||||
The configuration file here refers to the configuration file on the machine where the application that calls the JDBC client library is located, the default path is `/etc/taos/taos.cfg` on Linux, the default path is `C://TDengine/cfg/taos.cfg` on Windows, and the default path is `/etc/taos/taos.cfg` on macOS.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
@ -367,7 +368,7 @@ The configuration parameters in properties are as follows.
|
|||
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 60000 ms. It only takes effect when using JDBC REST connection and batchfetch is true.
|
||||
- TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL connection, false: not using SSL connection. It only takes effect when using JDBC REST connection.
|
||||
- TSDBDriver.HTTP_POOL_SIZE: size of REST concurrent requests. The default value is 20.
|
||||
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](/reference/config/#Client-Only).
|
||||
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](../../reference/config/#Client-Only).
|
||||
|
||||
### Priority of configuration parameters
|
||||
|
||||
|
@ -976,7 +977,7 @@ public void setTagGeometry(int index, byte[] value)
|
|||
|
||||
### Schemaless Writing
|
||||
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless).
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../reference/schemaless/).
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -1056,7 +1057,7 @@ writer.write(lineDemo, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO
|
|||
|
||||
### Data Subscription
|
||||
|
||||
The TDengine Java Connector supports subscription functionality with the following application API.
|
||||
The TDengine Java client library supports subscription functionality with the following application API.
|
||||
|
||||
#### Create a Topic
|
||||
|
||||
|
@ -1093,7 +1094,7 @@ TaosConsumer consumer = new TaosConsumer<>(config);
|
|||
- httpConnectTimeout: WebSocket connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using WebSocket type.
|
||||
- messageWaitTimeout: socket timeout in milliseconds, the default value is 10000 ms. It only takes effect when using WebSocket type.
|
||||
- httpPoolSize: Maximum number of concurrent requests on the a connection。It only takes effect when using WebSocket type.
|
||||
- For more information, see [Consumer Parameters](../../../develop/tmq). Note that the default value of auto.offset.reset in data subscription on the TDengine server has changed since version 3.2.0.0.
|
||||
- For more information, see [Consumer Parameters](../../develop/tmq). Note that the default value of auto.offset.reset in data subscription on the TDengine server has changed since version 3.2.0.0.
|
||||
|
||||
#### Subscribe to consume data
|
||||
|
||||
|
@ -1171,14 +1172,14 @@ consumer.unsubscribe();
|
|||
consumer.close()
|
||||
```
|
||||
|
||||
For more information, see [Data Subscription](../../../develop/tmq).
|
||||
For more information, see [Data Subscription](../../develop/tmq).
|
||||
|
||||
#### Full Sample Code
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
In addition to the native connection, the Java Connector also supports subscribing via websocket.
|
||||
In addition to the native connection, the Java client library also supports subscribing via websocket.
|
||||
|
||||
```java
|
||||
public abstract class ConsumerLoop {
|
||||
|
@ -1460,7 +1461,7 @@ The source code of the sample application is under `TDengine/examples/JDBC`:
|
|||
|
||||
**Solution**: Use taos-jdbcdriver 3.0.2.
|
||||
|
||||
For additional troubleshooting, see [FAQ](../../../train-faq/faq).
|
||||
For additional troubleshooting, see [FAQ](../../train-faq/faq).
|
||||
|
||||
## API Reference
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
---
|
||||
title: TDengine Go Connector
|
||||
title: TDengine Go Client Library
|
||||
sidebar_label: Go
|
||||
description: This document describes the TDengine Go connector.
|
||||
description: This document describes the TDengine Go client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import GoInsert from "../../07-develop/03-insert-data/_go_sql.mdx"
|
||||
import GoInfluxLine from "../../07-develop/03-insert-data/_go_line.mdx"
|
||||
import GoOpenTSDBTelnet from "../../07-develop/03-insert-data/_go_opts_telnet.mdx"
|
||||
import GoOpenTSDBJson from "../../07-develop/03-insert-data/_go_opts_json.mdx"
|
||||
import GoQuery from "../../07-develop/04-query-data/_go.mdx"
|
||||
import GoInsert from "../07-develop/03-insert-data/_go_sql.mdx"
|
||||
import GoInfluxLine from "../07-develop/03-insert-data/_go_line.mdx"
|
||||
import GoOpenTSDBTelnet from "../07-develop/03-insert-data/_go_opts_telnet.mdx"
|
||||
import GoOpenTSDBJson from "../07-develop/03-insert-data/_go_opts_json.mdx"
|
||||
import GoQuery from "../07-develop/04-query-data/_go.mdx"
|
||||
|
||||
`driver-go` is the official Go language connector for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data.
|
||||
`driver-go` is the official Go language client library for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data.
|
||||
|
||||
`driver-go` provides two ways to establish connections. One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The other is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
|
||||
|
||||
|
@ -74,14 +74,14 @@ If it is a TDengine error, you can get the error code and error information in t
|
|||
### Pre-installation preparation
|
||||
|
||||
* Install Go development environment (Go 1.14 and above, GCC 4.8.5 and above)
|
||||
* If you use the native connector, please install the TDengine client driver. Please refer to [Install Client Driver](/reference/connector/#install-client-driver) for specific steps
|
||||
* If you use the native connector, please install the TDengine client driver. Please refer to [Install Client Driver](../#install-client-driver) for specific steps
|
||||
|
||||
Configure the environment variables and check the command.
|
||||
|
||||
* ```go env```
|
||||
* ```gcc -v```
|
||||
|
||||
### Install the connectors
|
||||
### Install the client library
|
||||
|
||||
1. Initialize the project with the `go mod` command.
|
||||
|
||||
|
@ -222,11 +222,11 @@ func main() {
|
|||
|
||||
### Specify the URL and Properties to get the connection
|
||||
|
||||
The Go connector does not support this feature
|
||||
The Go client library does not support this feature
|
||||
|
||||
### Priority of configuration parameters
|
||||
|
||||
The Go connector does not support this feature
|
||||
The Go client library does not support this feature
|
||||
|
||||
## Usage examples
|
||||
|
||||
|
@ -769,7 +769,7 @@ You can get the unique id by `common.GetReqID()`.
|
|||
|
||||
### Data Subscription
|
||||
|
||||
The TDengine Go Connector supports subscription functionality with the following application API.
|
||||
The TDengine Go client library supports subscription functionality with the following application API.
|
||||
|
||||
#### Create a Topic
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: TDengine Rust Connector
|
||||
title: TDengine Rust Client Library
|
||||
sidebar_label: Rust
|
||||
description: This document describes the TDengine Rust connector.
|
||||
description: This document describes the TDengine Rust client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
|
@ -9,18 +9,18 @@ import Tabs from '@theme/Tabs';
|
|||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import Preparition from "./_preparation.mdx"
|
||||
import RustInsert from "../../07-develop/03-insert-data/_rust_sql.mdx"
|
||||
import RustBind from "../../07-develop/03-insert-data/_rust_stmt.mdx"
|
||||
import RustSml from "../../07-develop/03-insert-data/_rust_schemaless.mdx"
|
||||
import RustQuery from "../../07-develop/04-query-data/_rust.mdx"
|
||||
import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx"
|
||||
import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx"
|
||||
import RustSml from "../07-develop/03-insert-data/_rust_schemaless.mdx"
|
||||
import RustQuery from "../07-develop/04-query-data/_rust.mdx"
|
||||
|
||||
[](https://crates.io/crates/taos)  [](https://docs.rs/taos)
|
||||
|
||||
`taos` is the official Rust connector for TDengine. Rust developers can develop applications to access the TDengine instance data.
|
||||
`taos` is the official Rust client library for TDengine. Rust developers can develop applications to access the TDengine instance data.
|
||||
|
||||
`taos` provides two ways to establish connections. One is the **Native Connection**, which connects to TDengine instances via the TDengine client driver (taosc). The other is the **WebSocket connection**, which connects to TDengine instances via the WebSocket interface provided by taosAdapter. You can specify a connection type with Cargo features. By default, both types are supported. The Websocket connection can be used on any platform. The native connection can be used on any platform that the TDengine Client supports.
|
||||
|
||||
The source code for the Rust connectors is located on [GitHub](https://github.com/taosdata/taos-connector-rust).
|
||||
The source code for the Rust client library is located on [GitHub](https://github.com/taosdata/taos-connector-rust).
|
||||
|
||||
## Supported platforms
|
||||
|
||||
|
@ -37,7 +37,7 @@ Websocket connections are supported on all platforms that can run Go.
|
|||
| v0.7.6 | 3.0.3.0 | Support req_id in query. |
|
||||
| v0.6.0 | 3.0.0.0 | Base features. |
|
||||
|
||||
The Rust Connector is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 3.0 or higher to avoid known issues.
|
||||
The Rust client library is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 3.0 or higher to avoid known issues.
|
||||
|
||||
## Handling exceptions
|
||||
|
||||
|
@ -80,9 +80,9 @@ Note: Only TAG supports JSON types
|
|||
### Pre-installation preparation
|
||||
|
||||
* Install the Rust development toolchain
|
||||
* If using the native connection, please install the TDengine client driver. Please refer to [install client driver](/reference/connector#install-client-driver)
|
||||
* If using the native connection, please install the TDengine client driver. Please refer to [install client driver](../#install-client-driver)
|
||||
|
||||
### Install the connectors
|
||||
### Install the client library
|
||||
|
||||
Depending on the connection method, add the [taos][taos] dependency in your Rust project as follows:
|
||||
|
||||
|
@ -154,8 +154,8 @@ The structure of the DSN description string is as follows:
|
|||
|
||||
The parameters are described as follows:
|
||||
|
||||
- **driver**: Specify a driver name so that the connector can choose which method to use to establish the connection. Supported driver names are as follows:
|
||||
- **taos**: Table names use the TDengine connector driver.
|
||||
- **driver**: Specify a driver name so that the client library can choose which method to use to establish the connection. Supported driver names are as follows:
|
||||
- **taos**: Table names use the TDengine native connection driver.
|
||||
- **tmq**: Use the TMQ to subscribe to data.
|
||||
- **http/ws**: Use Websocket to establish connections.
|
||||
- **https/wss**: Use Websocket to establish connections, and enable SSL/TLS.
|
||||
|
@ -327,7 +327,7 @@ Parameter binding details see [API Reference](#stmt-api)
|
|||
|
||||
### Schemaless Writing
|
||||
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless).
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../reference/schemaless/).
|
||||
|
||||
<RustSml />
|
||||
|
||||
|
@ -347,7 +347,7 @@ client.put(&sml_data)?
|
|||
|
||||
### Data Subscription
|
||||
|
||||
TDengine starts subscriptions through [TMQ](../../../taos-sql/tmq/).
|
||||
TDengine starts subscriptions through [TMQ](../../taos-sql/tmq/).
|
||||
|
||||
#### Create a Topic
|
||||
|
||||
|
@ -361,7 +361,7 @@ taos.exec_many([
|
|||
|
||||
#### Create a Consumer
|
||||
|
||||
You create a TMQ connector by using a DSN.
|
||||
You create a TMQ connection by using a DSN.
|
||||
|
||||
```rust
|
||||
let tmq = TmqBuilder::from_dsn("taos://localhost:6030/?group.id=test")?;
|
||||
|
@ -442,7 +442,7 @@ The following parameters can be configured for the TMQ DSN. Only `group.id` is m
|
|||
|
||||
- `group.id`: Within a consumer group, load balancing is implemented by consuming messages on an at-least-once basis.
|
||||
- `client.id`: Subscriber client ID.
|
||||
- `auto.offset.reset`: Initial point of subscription. *earliest* subscribes from the beginning, and *latest* subscribes from the newest message. The default value varies depending on the TDengine version. For details, see [Data Subscription](https://docs.tdengine.com/develop/tmq/). Note: This parameter is set per consumer group.
|
||||
- `auto.offset.reset`: Initial point of subscription. *earliest* subscribes from the beginning, and *latest* subscribes from the newest message. The default value varies depending on the TDengine version. For details, see [Data Subscription](../../develop/tmq/). Note: This parameter is set per consumer group.
|
||||
- `enable.auto.commit`: Automatically commits. This can be enabled when data consistency is not essential.
|
||||
- `auto.commit.interval.ms`: Interval for automatic commits.
|
||||
|
||||
|
@ -488,7 +488,7 @@ The source code of the sample application is under `TDengine/examples/rust` :
|
|||
|
||||
## Frequently Asked Questions
|
||||
|
||||
For additional troubleshooting, see [FAQ](../../../train-faq/faq).
|
||||
For additional troubleshooting, see [FAQ](../../train-faq/faq).
|
||||
|
||||
## API Reference
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
---
|
||||
title: TDengine Python Connector
|
||||
title: TDengine Python Client Library
|
||||
sidebar_label: Python
|
||||
description: This document describes taospy, the TDengine Python connector.
|
||||
description: This document describes taospy, the TDengine Python client library.
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
`taospy` is the official Python connector for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. `taospy` wraps both the [native interface](/reference/connector/cpp) and [REST interface](/reference/rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively.
|
||||
`taospy` is the official Python client library for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. `taospy` wraps both the [native interface](../cpp) and [REST interface](../../reference/rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively.
|
||||
In addition to wrapping the native and REST interfaces, `taospy` also provides a set of programming interfaces that conforms to the [Python Data Access Specification (PEP 249)](https://peps.python.org/pep-0249/). It is easy to integrate `taospy` with many third-party tools, such as [SQLAlchemy](https://www.sqlalchemy.org/) and [pandas](https://pandas.pydata.org/).
|
||||
|
||||
`taos-ws-py` is an optional package to enable using WebSocket to connect TDengine.
|
||||
|
||||
The direct connection to the server using the native interface provided by the client driver is referred to hereinafter as a "native connection"; the connection to the server using the REST or WebSocket interface provided by taosAdapter is referred to hereinafter as a "REST connection" or "WebSocket connection".
|
||||
|
||||
The source code for the Python connector is hosted on [GitHub](https://github.com/taosdata/taos-connector-python).
|
||||
The source code for the Python client library is hosted on [GitHub](https://github.com/taosdata/taos-connector-python).
|
||||
## Supported platforms
|
||||
|
||||
- The [supported platforms](/reference/connector/#supported-platforms) for the native connection are the same as the ones supported by the TDengine client.
|
||||
- The [supported platforms](../#supported-platforms) for the native connection are the same as the ones supported by the TDengine client.
|
||||
- REST connections are supported on all platforms that can run Python.
|
||||
|
||||
### Supported features
|
||||
|
@ -29,13 +29,13 @@ The source code for the Python connector is hosted on [GitHub](https://github.co
|
|||
|
||||
We recommend using the latest version of `taospy`, regardless of the version of TDengine.
|
||||
|
||||
|Python Connector Version|major changes|
|
||||
|Python Client Library Version|major changes|
|
||||
|:-------------------:|:----:|
|
||||
|2.7.12|1. added support for `varbinary` type (STMT does not yet support)<br/> 2. improved query performance (thanks to contributor [hadrianl](https://github.com/taosdata/taos-connector-python/pull/209))|
|
||||
|2.7.9|support for getting assignment and seek function on subscription|
|
||||
|2.7.8|add `execute_many` method|
|
||||
|
||||
|Python Websocket Connector Version|major changes|
|
||||
|Python Websocket Connection Version|major changes|
|
||||
|:----------------------------:|:-----:|
|
||||
|0.2.9|bugs fixes|
|
||||
|0.2.5|1. support for getting assignment and seek function on subscription <br/> 2. support schemaless <br/> 3. support STMT|
|
||||
|
@ -43,9 +43,9 @@ We recommend using the latest version of `taospy`, regardless of the version of
|
|||
|
||||
## Handling Exceptions
|
||||
|
||||
There are 4 types of exception in python connector.
|
||||
There are 4 types of exception in python client library.
|
||||
|
||||
- The exception of Python Connector itself.
|
||||
- The exception of Python client library itself.
|
||||
- The exception of native library.
|
||||
- The exception of websocket
|
||||
- The exception of subscription.
|
||||
|
@ -55,7 +55,7 @@ There are 4 types of exception in python connector.
|
|||
|:--------:|:---------:|:---------------:|
|
||||
|InterfaceError|the native library is too old that it cannot support the function|please check the TDengine client version|
|
||||
|ConnectionError|connection error|please check TDengine's status and the connection params|
|
||||
|DatabaseError|database error|please upgrade Python connector to latest|
|
||||
|DatabaseError|database error|please upgrade Python client library to latest|
|
||||
|OperationalError|operation error||
|
||||
|ProgrammingError|||
|
||||
|StatementError|the exception of stmt||
|
||||
|
@ -65,7 +65,7 @@ There are 4 types of exception in python connector.
|
|||
|
||||
It usually uses try-expect to handle exceptions in python. For exception handling, please refer to [Python Errors and Exceptions Documentation](https://docs.python.org/3/tutorial/errors.html).
|
||||
|
||||
All exceptions from the Python Connector are thrown directly. Applications should handle these exceptions. For example:
|
||||
All exceptions from the Python client library are thrown directly. Applications should handle these exceptions. For example:
|
||||
|
||||
```python
|
||||
{{#include docs/examples/python/handle_exception.py}}
|
||||
|
@ -95,20 +95,20 @@ TDengine currently supports timestamp, number, character, Boolean type, and the
|
|||
|
||||
1. Install Python. The recent taospy package requires Python 3.6.2+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it.
|
||||
2. Install [pip](https://pypi.org/project/pip/). In most cases, the Python installer comes with the pip utility. If not, please refer to [pip documentation](https://pip.pypa.io/en/stable/installation/) to install it.
|
||||
If you use a native connection, you will also need to [Install Client Driver](/reference/connector#Install-Client-Driver). The client install package includes the TDengine client dynamic link library (`libtaos.so` or `taos.dll`) and the TDengine CLI.
|
||||
If you use a native connection, you will also need to [Install Client Driver](../#Install-Client-Driver). The client install package includes the TDengine client dynamic link library (`libtaos.so` or `taos.dll`) and the TDengine CLI.
|
||||
|
||||
### Install via pip
|
||||
|
||||
#### Uninstalling an older version
|
||||
|
||||
If you have installed an older version of the Python Connector, please uninstall it beforehand.
|
||||
If you have installed an older version of the Python client library, please uninstall it beforehand.
|
||||
|
||||
```
|
||||
pip3 uninstall taos taospy
|
||||
```
|
||||
|
||||
:::note
|
||||
Earlier TDengine client software includes the Python connector. If the Python connector is installed from the client package's installation directory, the corresponding Python package name is `taos`. So the above uninstall command includes `taos`, and it doesn't matter if it doesn't exist.
|
||||
Earlier TDengine client software includes the Python client library. If the Python client library is installed from the client package's installation directory, the corresponding Python package name is `taos`. So the above uninstall command includes `taos`, and it doesn't matter if it doesn't exist.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -160,7 +160,7 @@ pip3 install taos-ws-py
|
|||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
For native connection, you need to verify that both the client driver and the Python connector itself are installed correctly. The client driver and Python connector have been installed properly if you can successfully import the `taos` module. In the Python Interactive Shell, you can type.
|
||||
For native connection, you need to verify that both the client driver and the Python client library itself are installed correctly. The client driver and Python client library have been installed properly if you can successfully import the `taos` module. In the Python Interactive Shell, you can type.
|
||||
|
||||
```python
|
||||
import taos
|
||||
|
@ -202,7 +202,7 @@ Requirement already satisfied: taospy in c:\users\username\appdata\local\program
|
|||
|
||||
### Connectivity testing
|
||||
|
||||
Before establishing a connection with the connector, we recommend testing the connectivity of the local TDengine CLI to the TDengine cluster.
|
||||
Before establishing a connection with the client library, we recommend testing the connectivity of the local TDengine CLI to the TDengine cluster.
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -436,11 +436,22 @@ The `TaosConnection` class and the `TaosResult` class already implement all the
|
|||
:::note
|
||||
The TaosCursor class uses native connections for write and query operations. In a client-side multi-threaded scenario, this cursor instance must remain thread exclusive and cannot be shared across threads for use, otherwise, it will result in errors in the returned results.
|
||||
|
||||
The best practice for TaosCursor is to create a cursor at the beginning of a query and close it immediately after use. Please avoid reusing the same cursor for multiple executions.
|
||||
:::
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_example.py}}
|
||||
```
|
||||
|
||||
For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html).
|
||||
|
||||
##### Use of TaosRestCursor class
|
||||
|
||||
The `TaosRestCursor` class is an implementation of the PEP249 Cursor interface.
|
||||
|
@ -452,15 +463,9 @@ The `TaosRestCursor` class is an implementation of the PEP249 Cursor interface.
|
|||
- `cursor.rowcount` : For write operations, returns the number of successful rows written. For query operations, returns the number of rows in the result set.
|
||||
- `cursor.description` : Returns the description of the field. Please refer to [TaosRestCursor](https://docs.taosdata.com/api/taospy/taosrest/cursor.html) for the specific format of the description information.
|
||||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](/reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_example.py}}
|
||||
```
|
||||
|
||||
For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html).
|
||||
:::note
|
||||
The best practice for TaosRestCursor is to create a cursor at the beginning of a query and close it immediately after use. Please avoid reusing the same cursor for multiple executions.
|
||||
:::
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="websocket" label="WebSocket connection">
|
||||
|
@ -496,7 +501,7 @@ The queried results can only be fetched once. For example, only one of `fetch_al
|
|||
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](/reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python
|
||||
{{#include docs/examples/python/rest_client_example.py}}
|
||||
|
@ -554,6 +559,16 @@ The `TaosConnection` class and the `TaosResult` class already implement all the
|
|||
</TabItem>
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_with_req_id_example.py}}
|
||||
```
|
||||
|
||||
For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html).
|
||||
|
||||
##### Use of TaosRestCursor class
|
||||
|
||||
As the way to connect introduced above but add `req_id` argument.
|
||||
|
@ -565,16 +580,6 @@ As the way to connect introduced above but add `req_id` argument.
|
|||
- `cursor.rowcount` : For write operations, returns the number of successful rows written. For query operations, returns the number of rows in the result set.
|
||||
- `cursor.description` : Returns the description of the field. Please refer to [TaosRestCursor](https://docs.taosdata.com/api/taospy/taosrest/cursor.html) for the specific format of the description information.
|
||||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](/reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_with_req_id_example.py}}
|
||||
```
|
||||
|
||||
For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html).
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="websocket" label="WebSocket connection">
|
||||
|
@ -619,7 +624,7 @@ As the way to connect introduced above but add `req_id` argument.
|
|||
|
||||
### Writing data via parameter binding
|
||||
|
||||
The Python connector provides a parameter binding api for inserting data. Similar to most databases, TDengine currently only supports the question mark `?` to indicate the parameters to be bound.
|
||||
The Python client library provides a parameter binding api for inserting data. Similar to most databases, TDengine currently only supports the question mark `?` to indicate the parameters to be bound.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -750,7 +755,7 @@ stmt.close()
|
|||
|
||||
### Schemaless Writing
|
||||
|
||||
Connector support schemaless insert.
|
||||
Client library support schemaless insert.
|
||||
|
||||
<Tabs defaultValue="list">
|
||||
<TabItem value="list" label="List Insert">
|
||||
|
@ -812,11 +817,11 @@ There is a optional parameter called `req_id` in `schemaless_insert` and `schema
|
|||
|
||||
### Data Subscription
|
||||
|
||||
Connector support data subscription. For more information about subscroption, please refer to [Data Subscription](../../../develop/tmq/).
|
||||
Client library support data subscription. For more information about subscroption, please refer to [Data Subscription](../../develop/tmq/).
|
||||
|
||||
#### Create a Topic
|
||||
|
||||
To create topic, please refer to [Data Subscription](../../../develop/tmq/#create-a-topic).
|
||||
To create topic, please refer to [Data Subscription](../../develop/tmq/#create-a-topic).
|
||||
|
||||
#### Create a Consumer
|
||||
|
||||
|
@ -824,7 +829,7 @@ To create topic, please refer to [Data Subscription](../../../develop/tmq/#creat
|
|||
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
The consumer in the connector contains the subscription api. The syntax for creating a consumer is consumer = Consumer(configs). For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer).
|
||||
The consumer in the client library contains the subscription api. The syntax for creating a consumer is consumer = Consumer(configs). For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer).
|
||||
|
||||
```python
|
||||
from taos.tmq import Consumer
|
||||
|
@ -835,9 +840,9 @@ consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"})
|
|||
|
||||
<TabItem value="websocket" label="WebSocket connection">
|
||||
|
||||
In addition to native connections, the connector also supports subscriptions via websockets.
|
||||
In addition to native connections, the client library also supports subscriptions via websockets.
|
||||
|
||||
The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer).
|
||||
The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer).
|
||||
|
||||
```python
|
||||
import taosws
|
||||
|
@ -1020,7 +1025,7 @@ consumer.close()
|
|||
|
||||
### About nanoseconds
|
||||
|
||||
Due to the current imperfection of Python's nanosecond support (see link below), the current implementation returns integers at nanosecond precision instead of the `datetime` type produced by `ms` and `us`, which application developers will need to handle on their own. And it is recommended to use pandas' to_datetime(). The Python Connector may modify the interface in the future if Python officially supports nanoseconds in full.
|
||||
Due to the current imperfection of Python's nanosecond support (see link below), the current implementation returns integers at nanosecond precision instead of the `datetime` type produced by `ms` and `us`, which application developers will need to handle on their own. And it is recommended to use pandas' to_datetime(). The Python client library may modify the interface in the future if Python officially supports nanoseconds in full.
|
||||
|
||||
1. https://stackoverflow.com/questions/10611328/parsing-datetime-strings-containing-nanoseconds
|
||||
2. https://www.python.org/dev/peps/pep-0564/
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: TDengine Node.js Connector
|
||||
title: TDengine Node.js Client Library
|
||||
sidebar_label: Node.js
|
||||
description: This document describes the TDengine Node.js connector.
|
||||
description: This document describes the TDengine Node.js client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
|
@ -9,32 +9,32 @@ import Tabs from "@theme/Tabs";
|
|||
import TabItem from "@theme/TabItem";
|
||||
|
||||
import Preparition from "./_preparation.mdx";
|
||||
import NodeInsert from "../../07-develop/03-insert-data/_js_sql.mdx";
|
||||
import NodeInfluxLine from "../../07-develop/03-insert-data/_js_line.mdx";
|
||||
import NodeOpenTSDBTelnet from "../../07-develop/03-insert-data/_js_opts_telnet.mdx";
|
||||
import NodeOpenTSDBJson from "../../07-develop/03-insert-data/_js_opts_json.mdx";
|
||||
import NodeQuery from "../../07-develop/04-query-data/_js.mdx";
|
||||
import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx";
|
||||
import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
|
||||
import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
|
||||
import NodeOpenTSDBJson from "../07-develop/03-insert-data/_js_opts_json.mdx";
|
||||
import NodeQuery from "../07-develop/04-query-data/_js.mdx";
|
||||
|
||||
`@tdengine/client` and `@tdengine/rest` are the official Node.js connectors. Node.js developers can develop applications to access TDengine instance data. Note: The connectors for TDengine 3.0 are different than those for TDengine 2.x. The new connectors do not support TDengine 2.x.
|
||||
`@tdengine/client` and `@tdengine/rest` are the official Node.js client libraries. Node.js developers can develop applications to access TDengine instance data. Note: The client libraries for TDengine 3.0 are different than those for TDengine 2.x. The new client libraries do not support TDengine 2.x.
|
||||
|
||||
`@tdengine/client` is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. `@tdengine/rest` is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The REST connector can run on any platform, but performance is slightly degraded, and the interface implements a somewhat different set of functional features than the native interface.
|
||||
`@tdengine/client` is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. `@tdengine/rest` is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The REST client library can run on any platform, but performance is slightly degraded, and the interface implements a somewhat different set of functional features than the native interface.
|
||||
|
||||
The source code for the Node.js connectors is located on [GitHub](https://github.com/taosdata/taos-connector-node/tree/3.0).
|
||||
The source code for the Node.js client libraries is located on [GitHub](https://github.com/taosdata/taos-connector-node/tree/3.0).
|
||||
|
||||
## Supported platforms
|
||||
|
||||
The platforms supported by the native connector are the same as those supported by the TDengine client driver.
|
||||
The REST connector supports all platforms that can run Node.js.
|
||||
The platforms supported by the native client library are the same as those supported by the TDengine client driver.
|
||||
The REST client library supports all platforms that can run Node.js.
|
||||
|
||||
## Version support
|
||||
|
||||
Please refer to [version support list](/reference/connector#version-support)
|
||||
Please refer to [version support list](../#version-support)
|
||||
|
||||
## Supported features
|
||||
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="Native connector">
|
||||
<TabItem value="native" label="Native connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
|
@ -44,7 +44,7 @@ Please refer to [version support list](/reference/connector#version-support)
|
|||
6. Schemaless
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connector">
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
|
@ -58,7 +58,7 @@ Please refer to [version support list](/reference/connector#version-support)
|
|||
### Pre-installation preparation
|
||||
|
||||
- Install the Node.js development environment
|
||||
- If you are using the REST connector, skip this step. However, if you use the native connector, please install the TDengine client driver. Please refer to [Install Client Driver](/reference/connector#Install-Client-Driver) for more details. We use [node-gyp](https://github.com/nodejs/node-gyp) to interact with TDengine instances and also need to install some dependencies mentioned below depending on the specific OS.
|
||||
- If you are using the REST client library, skip this step. However, if you use the native client library, please install the TDengine client driver. Please refer to [Install Client Driver](../#Install-Client-Driver) for more details. We use [node-gyp](https://github.com/nodejs/node-gyp) to interact with TDengine instances and also need to install some dependencies mentioned below depending on the specific OS.
|
||||
|
||||
<Tabs defaultValue="Linux">
|
||||
<TabItem value="Linux" label="Linux system installation dependencies">
|
||||
|
@ -103,14 +103,14 @@ If using ARM64 Node.js on Windows 10 ARM, you must add "Visual C++ compilers and
|
|||
### Install via npm
|
||||
|
||||
<Tabs defaultValue="install_rest">
|
||||
<TabItem value="install_native" label="Install native connector">
|
||||
<TabItem value="install_native" label="Install native clieny library">
|
||||
|
||||
```bash
|
||||
npm install @tdengine/client
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="install_rest" label="Install REST connector">
|
||||
<TabItem value="install_rest" label="Install REST client library">
|
||||
|
||||
```bash
|
||||
npm install @tdengine/rest
|
||||
|
@ -122,7 +122,7 @@ npm install @tdengine/rest
|
|||
### Verify
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="Native connector">
|
||||
<TabItem value="native" label="Native client library">
|
||||
|
||||
After installing the TDengine client, use the `nodejsChecker.js` program to verify that the current environment supports Node.js access to TDengine.
|
||||
|
||||
|
@ -141,7 +141,7 @@ node nodejsChecker.js host=localhost
|
|||
- After executing the above steps, the command-line will output the result of `nodejsChecker.js` connecting to the TDengine instance and performing a simple insert and query.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connector">
|
||||
<TabItem value="rest" label="REST client library">
|
||||
|
||||
After installing the TDengine client, use the `restChecker.js` program to verify that the current environment supports Node.js access to TDengine.
|
||||
|
||||
|
@ -164,7 +164,7 @@ node restChecker.js
|
|||
|
||||
## Establishing a connection
|
||||
|
||||
Please choose to use one of the connectors.
|
||||
Please choose to use one of the client libraries.
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -288,7 +288,7 @@ let cursor = conn.cursor();
|
|||
| [schemless insert](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/schemaless.js) | Schemaless insert |
|
||||
| [TMQ](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/tmq.js) | Using data subscription |
|
||||
| [asyncQuery](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/asyncQueryExample.js) | Using asynchronous queries |
|
||||
| [REST](https://github.com/taosdata/taos-connector-node/blob/3.0/typescript-rest/example/example.ts) | Using TypeScript with the REST connector |
|
||||
| [REST](https://github.com/taosdata/taos-connector-node/blob/3.0/typescript-rest/example/example.ts) | Using TypeScript with the REST client library |
|
||||
|
||||
## Usage limitations
|
||||
|
||||
|
@ -316,7 +316,7 @@ let cursor = conn.cursor();
|
|||
|
||||
## Important update records
|
||||
|
||||
### Native connectors
|
||||
### Native client library
|
||||
|
||||
| package name | version | TDengine version | Description |
|
||||
|------------------|---------|---------------------|------------------------------------------------------------------|
|
||||
|
@ -324,7 +324,7 @@ let cursor = conn.cursor();
|
|||
| td2.0-connector | 2.0.12 | 2.4.x; 2.5.x; 2.6.x | Fixed cursor.close() bug. |
|
||||
| td2.0-connector | 2.0.11 | 2.4.x; 2.5.x; 2.6.x | Supports parameter binding, JSON tags and schemaless interface |
|
||||
| td2.0-connector | 2.0.10 | 2.4.x; 2.5.x; 2.6.x | Supports connection management, standard queries, connection queries, system information, and data subscription |
|
||||
### REST Connector
|
||||
### REST client library
|
||||
|
||||
| package name | version | TDengine version | Description |
|
||||
|----------------------|---------|---------------------|---------------------------------------------------------------------------|
|
||||
|
@ -334,6 +334,3 @@ let cursor = conn.cursor();
|
|||
| td2.0-rest-connector | 1.0.5 | 2.4.x; 2.5.x; 2.6.x | Support cloud token |
|
||||
| td2.0-rest-connector | 1.0.3 | 2.4.x; 2.5.x; 2.6.x | Supports connection management, standard queries, system information, error information, and continuous queries |
|
||||
|
||||
## API Reference
|
||||
|
||||
[API Reference](https://docs.taosdata.com/api/td2.0-connector/)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
sidebar_label: ODBC
|
||||
title: TDengine ODBC
|
||||
---
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
TDengine ODBC driver is a driver specifically designed for TDengine based on the ODBC standard. It can be used by ODBC based applications on Windows to access a local or remote TDengine cluster or TDengine cloud service, like [PowerBI](https://powerbi.microsoft.com).
|
||||
|
||||
TDengine ODBC provides two kinds of connections, native connection and WebSocket connection. You can choose to use either one for your convenience, WebSocket is recommded choice and you must use WebSocket if you are trying to access TDengine cloud service.
|
||||
|
||||
Note: TDengine ODBC driver can only be run on 64-bit system, and can only be invoked by 64-bit applications.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
1. TDengine ODBC driver supports only Windows platform. To run on Windows, VisualStudio C Runtime library is required. If VisualStudio C Runtime Library is missing on your platform, you can download and install it from [VC Runtime Library](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
|
||||
|
||||
2. Install TDengine client package for Windows, the version should be above 3.2.1.0, the client package includes both TDengine ODBC driver and some other necessary libraries that will be used in either native connection or WebSocket connection.
|
||||
|
||||
## Configure Data Source
|
||||
|
||||
### Connection Types
|
||||
|
||||
TDengine ODBC driver supports two kinds of connections to TDengine cluster, native connection and WebSocket connection, here is the major differences between them.
|
||||
|
||||
1. Only WebSocket can connect to TDengine cloud service.
|
||||
|
||||
2. Websocket connection is more compatible with different TDengine server versions, normally you don't need to uupgrade client package with the server side.
|
||||
|
||||
3. Native connection normally has better performance, but you need to keep the version aligned with the server side.
|
||||
|
||||
4. For most users, it's recommended to use **WebSocket** connection, which has much better compatibility and almost same performance as native connection.
|
||||
|
||||
### WebSocket Connection
|
||||
|
||||
1. Click the "Start" Menu, and Search for "ODBC", and choose "ODBC Data Source (64-bit)" (Note: Don't choose 32-bit)
|
||||
|
||||
2. Select "User DSN" tab, and click "Add" to enter the page for "Create Data Source"
|
||||
|
||||
3. Choose the data source to be added, here we choose "TDengine"
|
||||
|
||||
4. Click "Finish", and enter the configuration page for "TDengine ODBC Data Source", fill in required fields
|
||||
|
||||

|
||||
|
||||
4.1 [DSN]: Data Source Name, required field, to name the new ODBC data source
|
||||
|
||||
4.2 [Connection Type]: required field, we choose "WebSocket"
|
||||
|
||||
4.3 [URL]: required field, the URL for the ODBC data source, for example, `http://localhost:6041` is the URL for a local TDengine cluster, `https://gw.cloud.taosdata.com?token=your_token` is the URL for a TDengine cloud service.
|
||||
|
||||
4.4 [Database]: optional field, the default database to access
|
||||
|
||||
4.5 [User]: optional field, only used for connection testing in step 5; If it's left as blank, "root" user will be used by default.
|
||||
|
||||
4.6 [Password]: optional field, only used for connection testing in step 5;
|
||||
|
||||
5. Click "Test Connecting" to test whether the data source can be connectted; if successful, it will prompt "connecting success"
|
||||
|
||||
6. Click "OK" to sae the configuration and exit.
|
||||
|
||||
7. You can also select an already configured data source name in step 2 to change existing configuration.
|
||||
|
||||
### Native Connection
|
||||
|
||||
Please be noted that native connection can't be used to access a TDengine client service.
|
||||
|
||||
The steps are exactly same as "WebSocket" connection, except for you choose "Native" in step 4.2.
|
||||
|
||||
|
||||
## PowerBI
|
||||
|
||||
As an example, you can use PowerBI, which inovkes TDengine ODBC driver, to access TDengine, please refer to[Power BI](../../third-party/powerbi) for more details.
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
toc_max_heading_level: 4
|
||||
sidebar_label: R
|
||||
title: R Language Connector
|
||||
title: R Language Client Library
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import Rdemo from "../../07-develop/01-connect/_connect_r.mdx"
|
||||
import Rdemo from "../07-develop/01-connect/_connect_r.mdx"
|
||||
|
||||
By using the RJDBC library in R, you can enable R programs to access TDengine data. Here are the installation process, configuration steps, and an example code in R.
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
title: PHP Connector
|
||||
title: PHP Client Library
|
||||
sidebar_label: PHP
|
||||
description: This document describes the TDengine PHP connector.
|
||||
description: This document describes the TDengine PHP client library.
|
||||
---
|
||||
|
||||
`php-tdengine` is the TDengine PHP connector provided by TDengine community. In particular, it supports Swoole coroutine.
|
||||
`php-tdengine` is the TDengine PHP client library provided by TDengine community. In particular, it supports Swoole coroutine.
|
||||
|
||||
PHP Connector relies on TDengine client driver.
|
||||
PHP client library relies on TDengine client driver.
|
||||
|
||||
Project Repository: <https://github.com/Yurunsoft/php-tdengine>
|
||||
|
||||
|
@ -40,7 +40,7 @@ Because the version of TDengine client driver is tightly associated with that of
|
|||
|
||||
### Install TDengine Client Driver
|
||||
|
||||
Regarding how to install TDengine client driver please refer to [Install Client Driver](/reference/connector#installation-steps)
|
||||
Regarding how to install TDengine client driver please refer to [Install Client Driver](../#installation-steps)
|
||||
|
||||
### Install php-tdengine
|
||||
|
||||
|
@ -81,7 +81,7 @@ Option Two: Use CLI `php -dextension=tdengine test.php`.
|
|||
|
||||
## Sample Programs
|
||||
|
||||
In this section a few sample programs which use TDengine PHP connector to access TDengine cluster are demonstrated.
|
||||
In this section a few sample programs which use TDengine PHP client library to access TDengine cluster are demonstrated.
|
||||
|
||||
> Any error would throw exception: `TDengine\Exception\TDengineException`
|
||||
|
|
@ -0,0 +1 @@
|
|||
label: "Client Libraries"
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
:::info
|
||||
|
||||
Since the TDengine client driver is written in C, using the native connection requires loading the client driver shared library file, which is usually included in the TDengine installer. You can install either standard TDengine server installation package or [TDengine client installation package](/get-started/). For Windows development, you need to install the corresponding Windows client, please refer to [Install TDengine](../../get-started/package).
|
||||
Since the TDengine client driver is written in C, using the native connection requires loading the client driver shared library file, which is usually included in the TDengine installer. You can install either standard TDengine server installation package or [TDengine client installation package](../get-started/). For Windows development, you need to install the corresponding Windows client, please refer to [Install TDengine](../../get-started/package).
|
||||
|
||||
- libtaos.so: After successful installation of TDengine on a Linux system, the dependent Linux version of the client driver `libtaos.so` file will be automatically linked to `/usr/lib/libtaos.so`, which is included in the Linux scannable path and does not need to be specified separately.
|
||||
- taos.dll: After installing the client on Windows, the dependent Windows version of the client driver taos.dll file will be automatically copied to the system default search path C:/Windows/System32, again without the need to specify it separately.
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Connector
|
||||
description: This document describes the connectors that TDengine provides to interface with various programming languages.
|
||||
title: Client Libraries
|
||||
description: This document describes the client libraries that TDengine provides to interface with various programming languages.
|
||||
---
|
||||
|
||||
TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports connectors for multiple programming languages, including official connectors for C/C++, Java, Python, Go, Node.js, C#, and Rust. These connectors support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector.
|
||||
TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports client libraries for multiple programming languages, including official libraries for C/C++, Java, Python, Go, Node.js, C#, and Rust. These client libraries support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial client libraries, such as the ADO.NET, Lua, and PHP libraries.
|
||||
|
||||

|
||||

|
||||
|
||||
## Supported platforms
|
||||
|
||||
Currently, TDengine's native interface connectors can support platforms such as x64 and ARM hardware platforms and Linux/Windows/macOS development environments. The comparison matrix is as follows.
|
||||
Currently, TDengine's native interface client libraries can support platforms such as x64 and ARM hardware platforms and Linux/Windows/macOS development environments. The comparison matrix is as follows.
|
||||
|
||||
| **CPU** | **OS** | **Java** | **Python** | **Go** | **Node.js** | **C#** | **Rust** | C/C++ |
|
||||
| -------------- | --------- | -------- | ---------- | ------ | ----------- | ------ | -------- | ----- |
|
||||
|
@ -25,7 +25,7 @@ Using REST connection can support a broader range of operating systems as it doe
|
|||
|
||||
## Version support
|
||||
|
||||
TDengine version updates often add new features, and the connector versions in the list are the best-fit versions of the connector.
|
||||
TDengine version updates often add new features, and the client library versions in the list are the best-fit versions of the library.
|
||||
|
||||
| **TDengine Versions** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
|
||||
| --------------------------- | -------------- | -------------- | -------------- | ------------- | --------------- | --------------- |
|
||||
|
@ -37,7 +37,7 @@ TDengine version updates often add new features, and the connector versions in t
|
|||
|
||||
## Functional Features
|
||||
|
||||
Comparing the connector support for TDengine functional features as follows.
|
||||
Comparing the client library support for TDengine functional features as follows.
|
||||
|
||||
### Using the native interface (taosc)
|
||||
|
||||
|
@ -66,7 +66,7 @@ The different database framework specifications for various programming language
|
|||
|
||||
:::warning
|
||||
|
||||
- Regardless of the programming language chosen for the connector, TDengine versions 2.0 and above recommend that each thread of a database application create a separate connection. Or create a connection pool based on threads to avoid interference between threads with the "USE statement" state within a connection (but the connection's query and write operations are thread-safe).
|
||||
- Regardless of the programming language chosen for the client library, TDengine versions 2.0 and above recommend that each thread of a database application create a separate connection. Or create a connection pool based on threads to avoid interference between threads with the "USE statement" state within a connection (but the connection's query and write operations are thread-safe).
|
||||
|
||||
:::
|
||||
|
||||
|
@ -82,7 +82,7 @@ import VerifyMacOS from "./_verify_macos.mdx";
|
|||
## Install Client Driver
|
||||
|
||||
:::info
|
||||
The client driver needs to be installed if you use the native interface connector on a system that does not have the TDengine server software installed.
|
||||
The client driver needs to be installed if you use the native interface connection on a system that does not have the TDengine server software installed.
|
||||
|
||||
:::
|
||||
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
@ -72,7 +72,7 @@ For all the dnodes in a TDengine cluster, the below parameters must be configure
|
|||
|
||||
## Start Cluster
|
||||
|
||||
The first dnode can be started following the instructions in [Get Started](/get-started/). Then TDengine CLI `taos` can be launched to execute command `show dnodes`, the output is as following for example:
|
||||
The first dnode can be started following the instructions in [Get Started](../../get-started/). Then TDengine CLI `taos` can be launched to execute command `show dnodes`, the output is as following for example:
|
||||
|
||||
```
|
||||
taos> show dnodes;
|
||||
|
@ -90,7 +90,7 @@ From the above output, it is shown that the end point of the started dnode is "h
|
|||
|
||||
There are a few steps necessary to add other dnodes in the cluster.
|
||||
|
||||
Second, we can start `taosd` as instructed in [Get Started](/get-started/).
|
||||
Second, we can start `taosd` as instructed in [Get Started](../../get-started/).
|
||||
|
||||
Then, on the first dnode i.e. h1.tdengine.com in our example, use TDengine CLI `taos` to execute the following command:
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ docker run -d --name tdengine \
|
|||
* /var/lib/taos: TDengine's default data file directory. The location can be changed via [configuration file]. And also you can modify ~/data/taos/dnode/data to your any other local emtpy data directory
|
||||
* /var/log/taos: TDengine's default log file directory. The location can be changed via [configure file]. And also you can modify ~/data/taos/dnode/log to your any other local empty log directory
|
||||
|
||||
|
||||
:::
|
||||
|
||||
The above command starts a container named "tdengine" and maps the HTTP service port 6041 to the host port 6041. You can verify that the HTTP service provided in this container is available using the following command.
|
||||
|
@ -42,7 +43,7 @@ taos> show databases;
|
|||
Query OK, 2 row(s) in set (0.002843s)
|
||||
```
|
||||
|
||||
The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various connectors (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various connectors for complex scenarios.
|
||||
The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various client libraries (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various client libraries for complex scenarios.
|
||||
|
||||
## Start TDengine on the host network
|
||||
|
||||
|
@ -83,7 +84,7 @@ Next, ensure the hostname "tdengine" is resolvable in `/etc/hosts`.
|
|||
echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts
|
||||
```
|
||||
|
||||
Finally, the TDengine service can be accessed from the TDengine CLI or any connector with "tdengine" as the server address.
|
||||
Finally, the TDengine service can be accessed from the TDengine CLI or any client library with "tdengine" as the server address.
|
||||
|
||||
```shell
|
||||
taos -h tdengine -P 6030
|
||||
|
@ -324,6 +325,7 @@ services:
|
|||
- The `VERSION` environment variable is used to set the tdengine image tag
|
||||
- `TAOS_FIRST_EP` must be set on the newly created instance so that it can join the TDengine cluster; if there is a high availability requirement, `TAOS_SECOND_EP` needs to be used at the same time
|
||||
|
||||
|
||||
:::
|
||||
|
||||
2. Start the cluster
|
||||
|
|
|
@ -26,7 +26,6 @@ database_option: {
|
|||
| PAGESIZE value
|
||||
| PRECISION {'ms' | 'us' | 'ns'}
|
||||
| REPLICA value
|
||||
| RETENTIONS ingestion_duration:keep_duration ...
|
||||
| WAL_LEVEL {1 | 2}
|
||||
| VGROUPS value
|
||||
| SINGLE_STABLE {0 | 1}
|
||||
|
@ -47,6 +46,7 @@ database_option: {
|
|||
- last_row: The last row of each subtable is cached. This option significantly improves the performance of the LAST_ROW function.
|
||||
- last_value: The last non-null value of each column in each subtable is cached. This option significantly improves the performance of the LAST function under normal circumstances, such as statements including the WHERE, ORDER BY, GROUP BY, and INTERVAL keywords.
|
||||
- both: The last row of each subtable and the last non-null value of each column in each subtable are cached.
|
||||
Note: If you turn on cachemodel, then turn off, and turn on again, the result of last/last_row may be wrong, don't do like this, it's strongly recommended to always turn on the cache using "both".
|
||||
- CACHESIZE: specifies the amount (in MB) of memory used for subtable caching on each vnode. Enter a value between 1 and 65536. The default value is 1.
|
||||
- COMP: specifies how databases are compressed. The default value is 2.
|
||||
- 0: Compression is disabled.
|
||||
|
@ -61,7 +61,6 @@ database_option: {
|
|||
- PAGESIZE: specifies the size (in KB) of each page in the metadata storage engine cache on each vnode. The default value is 4. Enter a value between 1 and 16384.
|
||||
- PRECISION: specifies the precision at which a database records timestamps. Enter ms for milliseconds, us for microseconds, or ns for nanoseconds. The default value is ms.
|
||||
- REPLICA: specifies the number of replicas that are made of the database. Enter 1 or 3. The default value is 1. The value of the REPLICA parameter cannot exceed the number of dnodes in the cluster.
|
||||
- RETENTIONS: specifies the retention period for data aggregated at various intervals. For example, RETENTIONS 15s:7d,1m:21d,15m:50d indicates that data aggregated every 15 seconds is retained for 7 days, data aggregated every 1 minute is retained for 21 days, and data aggregated every 15 minutes is retained for 50 days. You must enter three aggregation intervals and corresponding retention periods.
|
||||
- WAL_LEVEL: specifies whether fsync is enabled. The default value is 1.
|
||||
- 1: WAL is enabled but fsync is disabled.
|
||||
- 2: WAL and fsync are both enabled.
|
||||
|
@ -139,6 +138,10 @@ You can use `show <db_name>.vgroups;` to check the value of cacheload.
|
|||
|
||||
If the value of `cacheload` is very close to the value of `cachesize`, then it's very probably that `cachesize` is too small. If the value of `cacheload` is much smaller than the value of `cachesize`, then `cachesize` is big enough. You can use this simple principle to determine. Depending on how much memory is available in your system, you can choose to double `cachesize` or incrase it by even 5 or more times.
|
||||
|
||||
4. stt_trigger
|
||||
|
||||
Pleae make sure stopping data writing before trying to alter stt_trigger parameter.
|
||||
|
||||
:::note
|
||||
Other parameters cannot be modified after the database has been created.
|
||||
|
||||
|
|
|
@ -32,9 +32,6 @@ table_options:
|
|||
|
||||
table_option: {
|
||||
COMMENT 'string_value'
|
||||
| WATERMARK duration[,duration]
|
||||
| MAX_DELAY duration[,duration]
|
||||
| ROLLUP(func_name [, func_name] ...)
|
||||
| SMA(col_name [, col_name] ...)
|
||||
| TTL value
|
||||
}
|
||||
|
@ -54,11 +51,8 @@ table_option: {
|
|||
|
||||
**Parameter description**
|
||||
1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables.
|
||||
2. WATERMARK: specifies the time after which the window is closed. The default value is 5 seconds. Enter a value between 0 and 15 minutes in milliseconds, seconds, or minutes. You can enter multiple values separated by commas (,). This parameter applies only to supertables and takes effect only when the RETENTIONS parameter has been specified for the database.
|
||||
3. MAX_DELAY: specifies the maximum latency for pushing computation results. The default value is 15 minutes or the value of the INTERVAL parameter, whichever is smaller. Enter a value between 0 and 15 minutes in milliseconds, seconds, or minutes. You can enter multiple values separated by commas (,). Note: Retain the default value if possible. Configuring a small MAX_DELAY may cause results to be frequently pushed, affecting storage and query performance. This parameter applies only to supertables and takes effect only when the RETENTIONS parameter has been specified for the database.
|
||||
4. ROLLUP: specifies aggregate functions to roll up. Rolling up a function provides downsampled results based on multiple axes. This parameter applies only to supertables and takes effect only when the RETENTIONS parameter has been specified for the database. You can specify only one function to roll up. The rollup takes effect on all columns except TS. Enter one of the following values: avg, sum, min, max, last, or first.
|
||||
5. SMA: specifies functions on which to enable small materialized aggregates (SMA). SMA is user-defined precomputation of aggregates based on data blocks. Enter one of the following values: max, min, or sum This parameter can be used with supertables and standard tables.
|
||||
6. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The default value is 0, i.e. never expire.
|
||||
2. SMA: specifies functions on which to enable small materialized aggregates (SMA). SMA is user-defined precomputation of aggregates based on data blocks. Enter one of the following values: max, min, or sum This parameter can be used with supertables and standard tables.
|
||||
3. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The default value is 0, i.e. never expire.
|
||||
|
||||
## Create Subtables
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ description: This document describes how to insert data into TDengine.
|
|||
---
|
||||
|
||||
## Syntax
|
||||
|
||||
The writing of records supports two syntaxes, normal syntax and super table syntax. In the normal syntax, the table name immediately following `INSERT INTO` represents subtable names or regular table names. In the super table syntax, the table name immediately following `INSERT INTO` represents the super table name.
|
||||
### Normal Syntax
|
||||
```sql
|
||||
INSERT INTO
|
||||
tb_name
|
||||
|
@ -20,6 +21,15 @@ INSERT INTO
|
|||
|
||||
INSERT INTO tb_name [(field1_name, ...)] subquery
|
||||
```
|
||||
### Super Table Syntax
|
||||
```sql
|
||||
INSERT INTO
|
||||
stb1_name [(field1_name, ...)]
|
||||
VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
|
||||
[stb2_name [(field1_name, ...)]
|
||||
VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
|
||||
...];
|
||||
```
|
||||
|
||||
**Timestamps**
|
||||
|
||||
|
@ -32,26 +42,34 @@ INSERT INTO tb_name [(field1_name, ...)] subquery
|
|||
|
||||
**Syntax**
|
||||
|
||||
1. The USING clause automatically creates the specified subtable if it does not exist. If it's unknown whether the table already exists, the table can be created automatically while inserting using the SQL statement below. To use this functionality, a STable must be used as template and tag values must be provided. Any tags that you do not specify will be assigned a null value.
|
||||
1. You can insert data into specified columns. Any columns in which you do not insert data will be assigned a null value.
|
||||
|
||||
2. You can insert data into specified columns. Any columns in which you do not insert data will be assigned a null value.
|
||||
2. The VALUES clause inserts one or more rows of data into a table.
|
||||
|
||||
3. The VALUES clause inserts one or more rows of data into a table.
|
||||
3. The FILE clause inserts tags or data from a comma-separates values (CSV) file. Do not include headers in your CSV files.
|
||||
|
||||
4. The FILE clause inserts tags or data from a comma-separates values (CSV) file. Do not include headers in your CSV files.
|
||||
4. A single `INSERT ... VALUES` statement and `INSERT ... FILE` statement can write data to multiple tables.
|
||||
|
||||
5. A single `INSERT ... VALUES` statement and `INSERT ... FILE` statement can write data to multiple tables.
|
||||
|
||||
6. The INSERT statement is fully parsed before being executed, so that if any element of the statement fails, the entire statement will fail. For example, the following statement will not create a table because the latter part of the statement is invalid:
|
||||
5. The INSERT statement is fully parsed before being executed, so that if any element of the statement fails, the entire statement will fail. For example, the following statement will not create a table because the latter part of the statement is invalid:
|
||||
|
||||
```sql
|
||||
INSERT INTO d1001 USING meters TAGS('Beijing.Chaoyang', 2) VALUES('a');
|
||||
```
|
||||
|
||||
7. However, an INSERT statement that writes data to multiple subtables can succeed for some tables and fail for others. This situation is caused because vnodes perform write operations independently of each other. One vnode failing to write data does not affect the ability of other vnodes to write successfully.
|
||||
6. However, an INSERT statement that writes data to multiple subtables can succeed for some tables and fail for others. This situation is caused because vnodes perform write operations independently of each other. One vnode failing to write data does not affect the ability of other vnodes to write successfully.
|
||||
|
||||
8. Data from TDengine can be inserted into a specified table using the `INSERT ... subquery` statement. Arbitrary query statements are supported. This syntax can only be used for subtables and normal tables, and does not support automatic table creation.
|
||||
**Normal Syntax**
|
||||
1. The USING clause automatically creates the specified subtable if it does not exist. If it's unknown whether the table already exists, the table can be created automatically while inserting using the SQL statement below. To use this functionality, a STable must be used as template and tag values must be provided. Any tags that you do not specify will be assigned a null value.
|
||||
|
||||
2. Data from TDengine can be inserted into a specified table using the `INSERT ... subquery` statement. Arbitrary query statements are supported. This syntax can only be used for subtables and normal tables, and does not support automatic table creation.
|
||||
|
||||
**Super Table Syntax**
|
||||
|
||||
1. The tbname column must be included in the field_name list and represents the name of the child table. This column is of string type, and the use of the . character is not permitted in the tbname column.
|
||||
|
||||
2. Tag columns are eligible for inclusion in the field_name list. If the specified child table doesn't exist, a new child table will be generated with the provided tag values. In the absence of specified tag values, the newly created table will have all NULL tag values. Existing child table tag values remain unchanged.
|
||||
|
||||
3. Param binding is not supported.
|
||||
## Insert a Record
|
||||
|
||||
Single row or multiple rows specified with VALUES can be inserted into a specific table. A single row is inserted using the below statement.
|
||||
|
@ -134,3 +152,14 @@ When writing data from a file, you can automatically create the specified subtab
|
|||
INSERT INTO d21001 USING meters TAGS ('California.SanFrancisco', 2) FILE '/tmp/csvfile_21001.csv'
|
||||
d21002 USING meters (groupId) TAGS (2) FILE '/tmp/csvfile_21002.csv';
|
||||
```
|
||||
## Super Table Syntax
|
||||
|
||||
Automatically creating table and the table name is specified through the `tbname` column
|
||||
|
||||
```sql
|
||||
INSERT INTO meters(tbname, location, groupId, ts, current, phase)
|
||||
values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32)
|
||||
('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33)
|
||||
('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33)
|
||||
```
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ description: This document describes how to query data in TDengine.
|
|||
```sql
|
||||
SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE() | CURRENT_USER() | USER() }
|
||||
|
||||
SELECT [hints] [DISTINCT] select_list
|
||||
SELECT [hints] [DISTINCT] [TAGS] select_list
|
||||
from_clause
|
||||
[WHERE condition]
|
||||
[partition_by_clause]
|
||||
|
@ -182,7 +182,7 @@ The TBNAME pseudocolumn in a supertable contains the names of subtables within t
|
|||
The following SQL statement returns all unique subtable names and locations within the meters supertable:
|
||||
|
||||
```mysql
|
||||
SELECT DISTINCT TBNAME, location FROM meters;
|
||||
SELECT TAGS TBNAME, location FROM meters;
|
||||
```
|
||||
|
||||
Use the `INS_TAGS` system table in `INFORMATION_SCHEMA` to query the information for subtables in a supertable. For example, the following statement returns the name and tag values for each subtable in the `meters` supertable.
|
||||
|
@ -227,6 +227,14 @@ The \_IROWTS pseudocolumn can only be used with INTERP function. This pseudocolu
|
|||
select _irowts, interp(current) from meters range('2020-01-01 10:00:00', '2020-01-01 10:30:00') every(1s) fill(linear);
|
||||
```
|
||||
|
||||
### TAGS Query
|
||||
|
||||
The TAGS keyword returns only tag columns from all child tables when only tag columns are specified. One row containing tag columns is returned for each child table.
|
||||
|
||||
```sql
|
||||
SELECT TAGS tag_name [, tag_name ...] FROM stb_name
|
||||
```
|
||||
|
||||
## Query Objects
|
||||
|
||||
`FROM` can be followed by a number of tables or super tables, or can be followed by a sub-query.
|
||||
|
@ -259,7 +267,11 @@ The GROUP BY clause does not guarantee that the results are ordered. If you want
|
|||
|
||||
## PARTITION BY
|
||||
|
||||
The PARTITION BY clause is a TDengine-specific extension to standard SQL. This clause partitions data based on the part_list and performs computations per partition.
|
||||
The PARTITION BY clause is a TDengine-specific extension to standard SQL introduced in TDengine 3.0. This clause partitions data based on the part_list and performs computations per partition.
|
||||
|
||||
PARTITION BY and GROUP BY have similar meanings. They both group data according to a specified list and then perform calculations. The difference is that PARTITION BY does not have various restrictions on the SELECT list of the GROUP BY clause. Any operation can be performed within the group (constants, aggregations, scalars, expressions, etc.). Therefore, PARTITION BY is fully compatible with GROUP BY in terms of usage. All places that use the GROUP BY clause can be replaced with PARTITION BY.
|
||||
|
||||
Because PARTITION BY does not require returning a row of aggregated data, it can also support various window operations after grouping slices. All window operations that need to be grouped can only use the PARTITION BY clause.
|
||||
|
||||
For more information, see TDengine Extensions.
|
||||
|
||||
|
|
|
@ -565,7 +565,7 @@ TO_TIMESTAMP(ts_str_literal, format_str_literal)
|
|||
- The uppercase or lowercase of `MONTH`, `MON`, `DAY`, `DY` and formtas that output digits have same effect when used in `to_timestamp`, like `to_timestamp('2023-JANUARY-01', 'YYYY-month-dd')`, `month` can be replaced by `MONTH`, or `month`. The cases are ignored.
|
||||
- If multi times are specified for one component, the previous will be overwritten. Like `to_timestamp('2023-22-10-10', 'yyyy-yy-MM-dd')`, the output year will be `2022`.
|
||||
- To avoid unexpected time zone used during the convertion, it's recommended to put time zone in the ts string, e.g. '2023-10-10 10:10:10+08'. If time zone not specified, default will be that in server or client.
|
||||
- The default timestamp if some components are not specified will be: `1970-01-01 00:00:00` with the timezone specified or default to local timezone.
|
||||
- The default timestamp if some components are not specified will be: `1970-01-01 00:00:00` with the timezone specified or default to local timezone. Only `DDD` is specified without `DD` is not supported currently, e.g. format 'yyyy-mm-ddd' is not supported, but 'yyyy-mm-dd' is supported.
|
||||
- If `AM` or `PM` is specified in formats, the Hour must between `1-12`.
|
||||
- In some cases, `to_timestamp` can convert correctly even the format and the timestamp string are not totally matched. Like `to_timetamp('200101/2', 'yyyyMM1/dd')`, the digit `1` in format string are ignored, and the output timestsamp is `2001-01-02 00:00:00`. Spaces and tabs in formats and tiemstamp string are also ignored automatically.
|
||||
- The precision of the output timestamp will be the same as the table in SELECT stmt, millisecond will be used if no table is specified. The output of `select to_timestamp('2023-08-1 10:10:10.123456789', 'yyyy-mm-dd hh:mi:ss.ns')` will be truncated to millisecond precision. If a nano precision table is specified, no truncation will be applied. Like `select to_timestamp('2023-08-1 10:10:10.123456789', 'yyyy-mm-dd hh:mi:ss.ns') from db_ns.table_ns limit 1`.
|
||||
|
@ -626,9 +626,9 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
|||
#### TIMETRUNCATE
|
||||
|
||||
```sql
|
||||
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
|
||||
TIMETRUNCATE(expr, time_unit [, use_current_timezone])
|
||||
|
||||
ignore_timezone: {
|
||||
use_current_timezone: {
|
||||
0
|
||||
| 1
|
||||
}
|
||||
|
@ -647,10 +647,11 @@ ignore_timezone: {
|
|||
1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks)
|
||||
- The precision of the returned timestamp is same as the precision set for the current data base in use
|
||||
- If the input data is not formatted as a timestamp, the returned value is null.
|
||||
- If `1d` is used as `time_unit` to truncate the timestamp, `ignore_timezone` option can be set to indicate if the returned result is affected by client timezone or not.
|
||||
For example, if client timezone is set to UTC+0800, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) will return '2020-01-01 08:00:00'.
|
||||
Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'.
|
||||
If `ignore_timezone` option is omitted, the default value is set to 1.
|
||||
- When using 1d/1w as the time unit to truncate timestamp, you can specify whether to truncate based on the current time zone by setting the use_current_timezone parameter.
|
||||
Value 0 indicates truncation using the UTC time zone, value 1 indicates truncation using the current time zone.
|
||||
For example, if the time zone configured by the Client is UTC + 0800, TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 0) returns the result of '2020-01-01 08:00:00'.
|
||||
When using TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 1), the result is 2020-01-01 00:00:00 '.
|
||||
When use_current_timezone is not specified, use_current_timezone defaults to 1.
|
||||
|
||||
#### TIMEZONE
|
||||
|
||||
|
|
|
@ -16,7 +16,10 @@ When you query a supertable, you may need to partition the supertable by some di
|
|||
PARTITION BY part_list
|
||||
```
|
||||
|
||||
part_list can be any scalar expression, such as a column, constant, scalar function, or a combination of the preceding items.
|
||||
part_list can be any scalar expression, such as a column, constant, scalar function, or a combination of the preceding items. For example, grouping data by label location, taking the average voltage within each group.
|
||||
```sql
|
||||
select location, avg(voltage) from meters partition by location
|
||||
```
|
||||
|
||||
A PARTITION BY clause is processed as follows:
|
||||
|
||||
|
@ -25,10 +28,13 @@ A PARTITION BY clause is processed as follows:
|
|||
- The PARTITION BY clause can be used together with a window clause or GROUP BY clause. In this case, the window or GROUP BY clause takes effect on every partition. For example, the following statement partitions the table by the location tag, performs downsampling over a 10 minute window, and returns the maximum value:
|
||||
|
||||
```sql
|
||||
select max(current) from meters partition by location interval(10m)
|
||||
select _wstart, location, max(current) from meters partition by location interval(10m)
|
||||
```
|
||||
|
||||
The most common usage of PARTITION BY is partitioning the data in subtables by tags then perform computation when querying data in a supertable. More specifically, `PARTITION BY TBNAME` partitions the data of each subtable into a single timeline, and this method facilitates the statistical analysis in many use cases of processing timeseries data.
|
||||
The most common usage of PARTITION BY is partitioning the data in subtables by tags then perform computation when querying data in a supertable. More specifically, `PARTITION BY TBNAME` partitions the data of each subtable into a single timeline, and this method facilitates the statistical analysis in many use cases of processing timeseries data. For example, calculate the average voltage of each meter every 10 minutes£º
|
||||
```sql
|
||||
select _wstart, tbname, avg(voltage) from meters partition by tbname interval(10m)
|
||||
```
|
||||
|
||||
## Windowed Queries
|
||||
|
||||
|
@ -38,11 +44,16 @@ Aggregation by time window is supported in TDengine. For example, in the case wh
|
|||
window_clause: {
|
||||
SESSION(ts_col, tol_val)
|
||||
| STATE_WINDOW(col)
|
||||
| INTERVAL(interval [, offset]) [SLIDING sliding] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})]
|
||||
| INTERVAL(interval_val [, offset]) [SLIDING (sliding_value)] [FILL({NONE | VALUE | PREV | NULL | LINEAR | NEXT})]
|
||||
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
|
||||
}
|
||||
```
|
||||
|
||||
Both interval_val and sliding_value are time durations which have 3 forms of representation.
|
||||
- INTERVAL(1s, 500a) SLIDING(1s), the unit char should be any one of a (millisecond), b (nanosecond), d (day), h (hour), m (minute), n (month), s (second), u (microsecond), w (week), y (year).
|
||||
- INTERVAL(1000, 500) SLIDING(1000), the unit will the same as the queried database, if there are more than one databases, higher precision will be used.
|
||||
- INTERVAL('1s', '500a') SLIDING('1s'), unit must be specified, no spaces allowed.
|
||||
|
||||
The following restrictions apply:
|
||||
|
||||
### Other Rules
|
||||
|
|
|
@ -41,7 +41,7 @@ The preceding command displays all topics in the current database.
|
|||
|
||||
## Create Consumer Group
|
||||
|
||||
You can create consumer groups only through the TDengine Client driver or the API provided by a connector.
|
||||
You can create consumer groups only through the TDengine Client driver or the API provided by a client library.
|
||||
|
||||
## Delete Consumer Group
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ CREATE AGGREGATE FUNCTION function_name AS library_path OUTPUTTYPE output_type [
|
|||
CREATE AGGREGATE FUNCTION l2norm AS "/home/taos/udf_example/libl2norm.so" OUTPUTTYPE DOUBLE bufsize 64;
|
||||
```
|
||||
|
||||
For more information about user-defined functions, see [User-Defined Functions](/develop/udf).
|
||||
For more information about user-defined functions, see [User-Defined Functions](../../develop/udf).
|
||||
|
||||
## Manage UDF
|
||||
|
||||
|
|
|
@ -59,4 +59,4 @@ Query OK, 9 row(s) affected (0.004763s)
|
|||
|
||||
## Import using taosdump
|
||||
|
||||
A convenient tool for importing and exporting data is provided by TDengine, `taosdump`, which can be used to export data from one TDengine cluster and import into another one. For the details of using `taosdump` please refer to [Tool for exporting and importing data: taosdump](/reference/taosdump).
|
||||
A convenient tool for importing and exporting data is provided by TDengine, `taosdump`, which can be used to export data from one TDengine cluster and import into another one. For the details of using `taosdump` please refer to the taosdump documentation.
|
||||
|
|
|
@ -19,4 +19,4 @@ The data of table or STable specified by `tb_name` will be exported into a file
|
|||
|
||||
## Export Using taosdump
|
||||
|
||||
With `taosdump`, you can choose to export the data of all databases, a database, a table or a STable, you can also choose to export the data within a time range, or even only export the schema definition of a table. For the details of using `taosdump` please refer to [Tool for exporting and importing data: taosdump](/reference/taosdump).
|
||||
With `taosdump`, you can choose to export the data of all databases, a database, a table or a STable, you can also choose to export the data within a time range, or even only export the schema definition of a table. For the details of using `taosdump` please refer to the taosdump documentation.
|
||||
|
|
|
@ -11,8 +11,6 @@ The collection of the monitoring information is enabled by default, but can be d
|
|||
|
||||
TDinsight is a complete solution which uses the monitoring database `log` mentioned previously, and Grafana, to monitor a TDengine cluster.
|
||||
|
||||
Please refer to [TDinsight Grafana Dashboard](../../reference/tdinsight) to learn more details about using TDinsight to monitor TDengine.
|
||||
|
||||
A script `TDinsight.sh` is provided to deploy TDinsight automatically.
|
||||
|
||||
Download `TDinsight.sh` with the below command:
|
||||
|
@ -43,7 +41,7 @@ Launch `TDinsight.sh` with the command above and restart Grafana, then open Dash
|
|||
|
||||
## log database
|
||||
|
||||
The data of tdinsight dashboard is stored in `log` database (default. You can change it in taoskeeper's config file. For more infrmation, please reference to [taoskeeper document](/reference/taosKeeper)). The taoskeeper will create log database on taoskeeper startup.
|
||||
The data of tdinsight dashboard is stored in `log` database (default. You can change it in taoskeeper's config file. For more infrmation, please reference to [taoskeeper document](../../reference/taosKeeper)). The taoskeeper will create log database on taoskeeper startup.
|
||||
|
||||
### cluster\_info table
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ description: This document describes the TDengine REST API.
|
|||
To support the development of various types of applications and platforms, TDengine provides an API that conforms to REST principles; namely REST API. To minimize the learning cost, unlike REST APIs for other database engines, TDengine allows insertion of SQL commands in the BODY of an HTTP POST request, to operate the database.
|
||||
|
||||
:::note
|
||||
One difference from the native connector is that the REST interface is stateless and so the `USE db_name` command has no effect. All references to table names and super table names need to specify the database name in the prefix. TDengine supports specification of the db_name in RESTful URL. If the database name prefix is not specified in the SQL command, the `db_name` specified in the URL will be used.
|
||||
One difference from the native connection is that the REST interface is stateless and so the `USE db_name` command has no effect. All references to table names and super table names need to specify the database name in the prefix. TDengine supports specification of the db_name in RESTful URL. If the database name prefix is not specified in the SQL command, the `db_name` specified in the URL will be used.
|
||||
:::
|
||||
|
||||
## Installation
|
||||
|
@ -262,6 +262,63 @@ The following types may be returned:
|
|||
- "INT UNSIGNED"
|
||||
- "BIGINT UNSIGNED"
|
||||
- "JSON"
|
||||
- "VARBINARY"
|
||||
- "GEOMETRY"
|
||||
|
||||
`VARBINARY` and `GEOMETRY` types return data as Hex string, example:
|
||||
|
||||
Prepare data
|
||||
|
||||
```bash
|
||||
create database demo
|
||||
use demo
|
||||
create table t(ts timestamp,c1 varbinary(20),c2 geometry(100))
|
||||
insert into t values(now,'\x7f8290','point(100 100)')
|
||||
```
|
||||
|
||||
Execute query
|
||||
|
||||
```bash
|
||||
curl --location 'http://<fqdn>:<port>/rest/sql' \
|
||||
--header 'Content-Type: text/plain' \
|
||||
--header 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' \
|
||||
--data 'select * from demo.t'
|
||||
```
|
||||
|
||||
Return results
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"column_meta": [
|
||||
[
|
||||
"ts",
|
||||
"TIMESTAMP",
|
||||
8
|
||||
],
|
||||
[
|
||||
"c1",
|
||||
"VARBINARY",
|
||||
20
|
||||
],
|
||||
[
|
||||
"c2",
|
||||
"GEOMETRY",
|
||||
100
|
||||
]
|
||||
],
|
||||
"data": [
|
||||
[
|
||||
"2023-11-01T06:28:15.210Z",
|
||||
"7f8290",
|
||||
"010100000000000000000059400000000000005940"
|
||||
]
|
||||
],
|
||||
"rows": 1
|
||||
}
|
||||
```
|
||||
|
||||
- `010100000000000000000059400000000000005940` is [Well-Known Binary (WKB)](https://libgeos.org/specifications/wkb/) format for `point(100 100)`
|
||||
|
||||
#### Errors
|
||||
|
||||
|
@ -514,4 +571,4 @@ Response body:
|
|||
|
||||
## Reference
|
||||
|
||||
[taosAdapter](/reference/taosadapter/)
|
||||
[taosAdapter](../taosadapter/)
|
||||
|
|
|
@ -1,315 +0,0 @@
|
|||
---
|
||||
title: C# Connector
|
||||
sidebar_label: C#
|
||||
description: This document describes the TDengine C# connector.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import Preparition from "./_preparation.mdx"
|
||||
import CSInsert from "../../07-develop/03-insert-data/_cs_sql.mdx"
|
||||
import CSInfluxLine from "../../07-develop/03-insert-data/_cs_line.mdx"
|
||||
import CSOpenTSDBTelnet from "../../07-develop/03-insert-data/_cs_opts_telnet.mdx"
|
||||
import CSOpenTSDBJson from "../../07-develop/03-insert-data/_cs_opts_json.mdx"
|
||||
import CSQuery from "../../07-develop/04-query-data/_cs.mdx"
|
||||
import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
|
||||
|
||||
`TDengine.Connector` is a C# language connector provided by TDengine that allows C# developers to develop C# applications that access TDengine cluster data.
|
||||
|
||||
The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc.The `TDengine.Connector` also supports WebSocket from v3.0.1 and developers can build connection through DSN, which supports data writing, querying, and parameter binding, etc.
|
||||
|
||||
This article describes how to install `TDengine.Connector` in a Linux or Windows environment and connect to TDengine clusters via `TDengine.Connector` to perform basic operations such as data writing and querying.
|
||||
|
||||
Note: TDengine Connector 3.x is not compatible with TDengine 2.x. In an environment with TDengine 2.x, you must use TDengine.Connector 1.x for the C# connector.
|
||||
|
||||
The source code of `TDengine.Connector` is hosted on [GitHub](https://github.com/taosdata/taos-connector-dotnet/tree/3.0).
|
||||
|
||||
## Supported platforms
|
||||
|
||||
The supported platforms are the same as those supported by the TDengine client driver.
|
||||
|
||||
:::note
|
||||
Please note TDengine does not support 32bit Windows any more.
|
||||
:::
|
||||
|
||||
## Version support
|
||||
|
||||
Please refer to [version support list](/reference/connector#version-support)
|
||||
|
||||
## Supported features
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
3. Continuous Query
|
||||
4. Parameter Binding
|
||||
5. Subscription
|
||||
6. Schemaless
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
3. Continuous Query
|
||||
4. Parameter Binding
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Installation Steps
|
||||
|
||||
### Pre-installation preparation
|
||||
|
||||
* Install the [.NET SDK](https://dotnet.microsoft.com/download)
|
||||
* [Nuget Client](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools) (optional installation)
|
||||
* Install TDengine client driver, please refer to [Install client driver](/reference/connector/#install-client-driver) for details
|
||||
|
||||
### Install `TDengine.Connector`
|
||||
|
||||
<Tabs defaultValue="CLI">
|
||||
<TabItem value="CLI" label="Native Connection">
|
||||
|
||||
You can reference the `TDengine.Connector` published in Nuget to the current project via the `dotnet` CLI under the path of the existing .NET project.
|
||||
|
||||
``` bash
|
||||
dotnet add package TDengine.Connector
|
||||
```
|
||||
|
||||
You may also modify the current.NET project file. You can include the following 'ItemGroup' in your project file (.csproj).
|
||||
|
||||
``` XML
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.*" />
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="source" label="WebSocket Connection">
|
||||
|
||||
In this scenario, modifying your project file is required in order to copy the WebSocket dependency dynamic library from the nuget package into your project.
|
||||
```XML
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TDengine.Connector" Version="3.0.*" GeneratePathProperty="true" />
|
||||
</ItemGroup>
|
||||
<Target Name="copyDLLDependency" BeforeTargets="BeforeBuild">
|
||||
<ItemGroup>
|
||||
<DepDLLFiles Include="$(PkgTDengine_Connector)\runtimes\**\*.*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(DepDLLFiles)" DestinationFolder="$(OutDir)" />
|
||||
</Target>
|
||||
```
|
||||
|
||||
Notice: `TDengine.Connector` only version>= 3.0.2 includes the dynamic library for WebSocket.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Establish a Connection
|
||||
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
``` csharp
|
||||
using TDengineDriver;
|
||||
|
||||
namespace TDengineExample
|
||||
{
|
||||
|
||||
internal class EstablishConnection
|
||||
{
|
||||
static void Main(String[] args)
|
||||
{
|
||||
string host = "localhost";
|
||||
short port = 6030;
|
||||
string username = "root";
|
||||
string password = "taosdata";
|
||||
string dbname = "";
|
||||
|
||||
var conn = TDengine.Connect(host, username, password, dbname, port);
|
||||
if (conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Connect to TDengine success");
|
||||
}
|
||||
TDengine.Close(conn);
|
||||
TDengine.Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
The structure of the DSN description string is as follows:
|
||||
|
||||
```text
|
||||
[<protocol>]://[[<username>:<password>@]<host>:<port>][/<database>][?<p1>=<v1>[&<p2>=<v2>]]
|
||||
|------------|---|-----------|-----------|------|------|------------|-----------------------|
|
||||
| protocol | | username | password | host | port | database | params |
|
||||
```
|
||||
|
||||
The parameters are described as follows:
|
||||
|
||||
* **protocol**: Specify which connection method to use (support http/ws). For example, `ws://localhost:6041` uses Websocket to establish connections.
|
||||
* **username/password**: Username and password used to create connections.
|
||||
* **host/port**: Specifies the server and port to establish a connection. Websocket connections default to `localhost:6041`.
|
||||
* **database**: Specify the default database to connect to. It's optional.
|
||||
* **params**: Optional parameters.
|
||||
|
||||
A sample DSN description string is as follows:
|
||||
|
||||
```text
|
||||
ws://localhost:6041/test
|
||||
```
|
||||
|
||||
``` csharp
|
||||
{{#include docs/examples/csharp/wsConnect/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Usage examples
|
||||
|
||||
### Write data
|
||||
|
||||
#### SQL Write
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
<CSInsert />
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
```csharp
|
||||
{{#include docs/examples/csharp/wsInsert/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
#### InfluxDB line protocol write
|
||||
|
||||
<CSInfluxLine />
|
||||
|
||||
#### OpenTSDB Telnet line protocol write
|
||||
|
||||
<CSOpenTSDBTelnet />
|
||||
|
||||
#### OpenTSDB JSON line protocol write
|
||||
|
||||
<CSOpenTSDBJson />
|
||||
|
||||
#### Parameter Binding
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
``` csharp
|
||||
{{#include docs/examples/csharp/stmtInsert/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
```csharp
|
||||
{{#include docs/examples/csharp/wsStmt/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Query data
|
||||
|
||||
#### Synchronous Query
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
|
||||
<TabItem value="native" label="Native Connection">
|
||||
|
||||
<CSQuery />
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="rest" label="WebSocket Connection">
|
||||
|
||||
```csharp
|
||||
{{#include docs/examples/csharp/wsQuery/Program.cs}}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
#### Asynchronous query
|
||||
|
||||
<CSAsyncQuery />
|
||||
|
||||
### More sample programs
|
||||
|
||||
|Sample program |Sample program description |
|
||||
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
|
||||
| [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/Query/Query.cs) | Table creation, data insertion, and query examples with TDengine.Connector |
|
||||
| [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/JSONTag) | Writing and querying JSON tag data with TDengine Connector |
|
||||
| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/NET6Examples/Stmt) | Parameter binding with TDengine Connector |
|
||||
| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/schemaless) | Schemaless writes with TDengine Connector |
|
||||
| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/AsyncQuery/QueryAsync.cs) | Asynchronous queries with TDengine Connector |
|
||||
| [Subscription](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/TMQ/TMQ.cs) | Subscription example with TDengine Connector |
|
||||
| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/FrameWork45/WS/WebSocketSample.cs) | WebSocket basic data in and out with TDengine connector |
|
||||
| [WebSocket Parameter Binding](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/FrameWork45/WS/WebSocketSTMT.cs) | WebSocket parameter binding example |
|
||||
|
||||
## Important update records
|
||||
|
||||
| TDengine.Connector | Description |
|
||||
|--------------------|--------------------------------|
|
||||
| 3.0.2 | Support .NET Framework 4.5 and above. Support .Net standard 2.0. Nuget package includes dynamic library for WebSocket.|
|
||||
| 3.0.1 | Support WebSocket and Cloud, With function query, insert, and parameter binding|
|
||||
| 3.0.0 | Supports TDengine 3.0.0.0. TDengine 2.x is not supported. Added `TDengine.Impl.GetData()` interface to deserialize query results. |
|
||||
| 1.0.7 | Fixed TDengine.Query() memory leak. |
|
||||
| 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. |
|
||||
| 1.0.5 | Fix Windows sync query Chinese error bug. | 1.0.4 | Fix schemaless bug. |
|
||||
| 1.0.4 | Add asynchronous query, subscription, and other functions. Fix the binding parameter bug. |
|
||||
| 1.0.3 | Add parameter binding, schemaless, JSON tag, etc. |
|
||||
| 1.0.2 | Add connection management, synchronous query, error messages, etc. |
|
||||
|
||||
## Other descriptions
|
||||
|
||||
### Third-party driver
|
||||
|
||||
`Taos` is an ADO.NET connector for TDengine, supporting Linux and Windows platforms. Community contributor `Maikebing@@maikebing contributes the connector`. Please refer to:
|
||||
|
||||
* Interface download:<https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos>
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
1. "Unable to establish connection", "Unable to resolve FQDN"
|
||||
|
||||
Usually, it's caused by an incorrect FQDN configuration. Please refer to this section in the [FAQ](https://docs.tdengine.com/2.4/train-faq/faq/#2-how-to-handle-unable-to-establish-connection) to troubleshoot.
|
||||
|
||||
2. Unhandled exception. System.DllNotFoundException: Unable to load DLL 'taos' or one of its dependencies: The specified module cannot be found.
|
||||
|
||||
This is usually because the program did not find the dependent client driver. The solution is to copy `C:\TDengine\driver\taos.dll` to the `C:\Windows\System32\` directory on Windows, and create the following soft link on Linux `ln -s /usr/local/taos/driver/libtaos.so.x.x .x.x /usr/lib/libtaos.so` will work.
|
||||
|
||||
## API Reference
|
||||
|
||||
[API Reference](https://docs.taosdata.com/api/connector-csharp/html/860d2ac1-dd52-39c9-e460-0829c4e5a40b.htm)
|
|
@ -1 +0,0 @@
|
|||
label: "Connector"
|
|
@ -186,7 +186,7 @@ See [example/config/taosadapter.toml](https://github.com/taosdata/taosadapter/bl
|
|||
|
||||
### TDengine RESTful interface
|
||||
|
||||
You can use any client that supports the http protocol to write data to or query data from TDengine by accessing the REST interface address `http://<fqdn>:6041/rest/sql`. See the [official documentation](/reference/rest-api/) for details.
|
||||
You can use any client that supports the http protocol to write data to or query data from TDengine by accessing the REST interface address `http://<fqdn>:6041/rest/sql`. See the [official documentation](../rest-api/) for details.
|
||||
|
||||
### InfluxDB
|
||||
|
||||
|
@ -202,7 +202,7 @@ Support InfluxDB query parameters as follows.
|
|||
- `precision` The time precision used by TDengine
|
||||
- `u` TDengine user name
|
||||
- `p` TDengine password
|
||||
- `ttl` The time to live of automatically created sub-table. This value cannot be updated. TDengine will use the ttl value of the first data of sub-table to create sub-table. For more information, please refer [Create Table](/taos-sql/table/#create-table)
|
||||
- `ttl` The time to live of automatically created sub-table. This value cannot be updated. TDengine will use the ttl value of the first data of sub-table to create sub-table. For more information, please refer [Create Table](../../taos-sql/table/#create-table)
|
||||
|
||||
Note: InfluxDB token authorization is not supported at present. Only Basic authorization and query parameter validation are supported.
|
||||
Example: curl --request POST http://127.0.0.1:6041/influxdb/v1/write?db=test --user "root:taosdata" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000"
|
||||
|
|
|
@ -31,7 +31,7 @@ There are two ways to install taosdump:
|
|||
2. backup multiple specified databases: use `-D db1,db2,... ` parameters;
|
||||
3. back up some super or normal tables in the specified database: use `dbname stbname1 stbname2 tbname1 tbname2 ... ` parameters. Note that the first parameter of this input sequence is the database name, and only one database is supported. The second and subsequent parameters are the names of super or normal tables in that database, separated by spaces.
|
||||
4. back up the system log database: TDengine clusters usually contain a system database named `log`. The data in this database is the data that TDengine runs itself, and the taosdump will not back up the log database by default. If users need to back up the log database, users can use the `-a` or `-allow-sys` command-line parameter.
|
||||
5. Loose mode backup: taosdump version 1.4.1 onwards provides `-n` and `-L` parameters for backing up data without using escape characters and "loose" mode, which can reduce the number of backups if table names, column names, tag names do not use escape characters. This can also reduce the backup data time and backup data footprint. If you are unsure about using `-n` and `-L` conditions, please use the default parameters for "strict" mode backup. See the [official documentation](/taos-sql/escape) for a description of escaped characters.
|
||||
5. Loose mode backup: taosdump version 1.4.1 onwards provides `-n` and `-L` parameters for backing up data without using escape characters and "loose" mode, which can reduce the number of backups if table names, column names, tag names do not use escape characters. This can also reduce the backup data time and backup data footprint. If you are unsure about using `-n` and `-L` conditions, please use the default parameters for "strict" mode backup. See the [official documentation](../../taos-sql/escape) for a description of escaped characters.
|
||||
|
||||
:::tip
|
||||
- taosdump versions after 1.4.1 provide the `-I` argument for parsing Avro file schema and data. If users specify `-s` then only taosdump will parse schema.
|
||||
|
|
|
@ -8,7 +8,7 @@ The TDengine command-line interface (hereafter referred to as `TDengine CLI`) is
|
|||
|
||||
## Installation
|
||||
|
||||
If executed on the TDengine server-side, there is no need for additional installation steps to install TDengine CLI as it is already included and installed automatically. To run TDengine CLI in an environment where no TDengine server is running, the TDengine client installation package needs to be installed first. For details, please refer to [Connector](/reference/connector/).
|
||||
If executed on the TDengine server-side, there is no need for additional installation steps to install TDengine CLI as it is already included and installed automatically. To run TDengine CLI in an environment where no TDengine server is running, the TDengine client installation package needs to be installed first. For details, please refer to [Install Client Driver](../../client-libraries/#install-client-driver).
|
||||
|
||||
## Execution
|
||||
|
||||
|
@ -18,7 +18,7 @@ To access the TDengine CLI, you can execute `taos` command-line utility from a t
|
|||
taos
|
||||
```
|
||||
|
||||
TDengine CLI will display a welcome message and version information if it successfully connected to the TDengine service. If it fails, TDengine CLI will print an error message. See [FAQ](/train-faq/faq) to solve the problem of terminal connection failure to the server. The TDengine CLI prompts as follows:
|
||||
TDengine CLI will display a welcome message and version information if it successfully connected to the TDengine service. If it fails, TDengine CLI will print an error message. See [FAQ](../../train-faq/faq) to solve the problem of terminal connection failure to the server. The TDengine CLI prompts as follows:
|
||||
|
||||
```cmd
|
||||
taos>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: List of supported platforms
|
||||
description: This document describes the supported platforms for the TDengine server, client, and connectors.
|
||||
description: This document describes the supported platforms for the TDengine server, client, and client libraries.
|
||||
---
|
||||
|
||||
## List of supported platforms for TDengine server
|
||||
|
@ -12,9 +12,9 @@ description: This document describes the supported platforms for the TDengine se
|
|||
|
||||
Note: 1) ● means officially tested and verified, ○ means unofficially tested and verified, E means only supported by the enterprise edition. 2) The community edition only supports newer versions of mainstream operating systems, including Ubuntu 18+/CentOS 7+/RetHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS, etc. If you have requirements for other operating systems and editions, please contact support of the enterprise edition.
|
||||
|
||||
## List of supported platforms for TDengine clients and connectors
|
||||
## List of supported platforms for TDengine clients and client libraries
|
||||
|
||||
TDengine's connector can support a wide range of platforms, including X64/X86/ARM64/ARM32/MIPS/Alpha/LoongArch64 hardware platforms and Linux/Win64/Win32/macOS development environments.
|
||||
TDengine's client libraries can support a wide range of platforms, including X64/X86/ARM64/ARM32/MIPS/Alpha/LoongArch64 hardware platforms and Linux/Win64/Win32/macOS development environments.
|
||||
|
||||
The comparison matrix is as follows.
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ Ensure that your firewall rules do not block TCP port 6042 on any host in the c
|
|||
| Protocol | Default Port | Description | How to configure |
|
||||
| :------- | :----------- | :-------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------- |
|
||||
| TCP | 6030 | Communication between client and server. In a multi-node cluster, communication between nodes. serverPort |
|
||||
| TCP | 6041 | REST connection between client and server | Prior to 2.4.0.0: serverPort+11; After 2.4.0.0 refer to [taosAdapter](/reference/taosadapter/) |
|
||||
| TCP | 6041 | REST connection between client and server | Prior to 2.4.0.0: serverPort+11; After 2.4.0.0 refer to [taosAdapter](../taosadapter/) |
|
||||
| TCP | 6043 | Service Port of taosKeeper | The parameter of taosKeeper |
|
||||
| TCP | 6044 | Data access port for StatsD | Configurable through taosAdapter parameters. |
|
||||
| UDP | 6045 | Data access for statsd | Configurable through taosAdapter parameters. |
|
||||
|
|
|
@ -116,7 +116,7 @@ You can configure smlChildTableName in taos.cfg to specify table names, for exam
|
|||
10. Taos.cfg adds the configuration of smlTsDefaultName (with a string value), which only works on the client side. After configuration, the time column name of the schemaless automatic table creation can be set through this configuration. If not configured, defaults to _ts.
|
||||
11. Super table name or child table name are case sensitive.
|
||||
:::tip
|
||||
All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed 48 KB(64 KB since version 3.0.5.0) and the total length of a tag value cannot exceed 16 KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area.
|
||||
All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed 48 KB(64 KB since version 3.0.5.0) and the total length of a tag value cannot exceed 16 KB. See [TDengine SQL Boundary Limits](../../taos-sql/limit) for specific constraints in this area.
|
||||
:::
|
||||
|
||||
## Time resolution recognition
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
title: Reference
|
||||
description: This document describes TDengine connectors and utilities.
|
||||
description: This document describes TDengine utilities.
|
||||
---
|
||||
|
||||
This section describes the TDengine connectors and utilities.
|
||||
This section describes the TDengine utilities.
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
|
|
@ -218,7 +218,7 @@ The example to query the average system memory usage for the specified interval
|
|||
|
||||
### Importing the Dashboard
|
||||
|
||||
You can install TDinsight dashboard in data source configuration page (like `http://localhost:3000/datasources/edit/1/dashboards`) as a monitoring visualization tool for TDengine cluster. Ensure that you use TDinsight for 3.x. Please note TDinsight for 3.x needs to configure and run taoskeeper correctly. Check the [TDinsight User Manual](/reference/tdinsight/) for the details.
|
||||
You can install TDinsight dashboard in data source configuration page (like `http://localhost:3000/datasources/edit/1/dashboards`) as a monitoring visualization tool for TDengine cluster. Ensure that you use TDinsight for 3.x. Please note TDinsight for 3.x needs to configure and run taoskeeper correctly.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ Prometheus data can be stored in TDengine via the `remote_write` interface with
|
|||
|
||||
To write Prometheus data to TDengine requires the following preparations.
|
||||
- The TDengine cluster is deployed and functioning properly
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](/reference/taosadapter) for details.
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](../../reference/taosadapter) for details.
|
||||
- Prometheus has been installed. Please refer to the [official documentation](https://prometheus.io/docs/prometheus/latest/installation/) for installing Prometheus
|
||||
|
||||
## Configuration steps
|
||||
|
|
|
@ -14,7 +14,7 @@ Telegraf's data can be written to TDengine by simply adding the output configura
|
|||
|
||||
To write Telegraf data to TDengine requires the following preparations.
|
||||
- The TDengine cluster is deployed and functioning properly
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](/reference/taosadapter) for details.
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](../../reference/taosadapter) for details.
|
||||
- Telegraf has been installed. Please refer to the [official documentation](https://docs.influxdata.com/telegraf/v1.22/install/) for Telegraf installation.
|
||||
- Telegraf collects the running status measurements of current system. You can enable [input plugins](https://docs.influxdata.com/telegraf/v1.22/plugins/) to insert [other formats](https://docs.influxdata.com/telegraf/v1.24/data_formats/input/) data to Telegraf then forward to TDengine.
|
||||
|
||||
|
@ -73,6 +73,6 @@ Query OK, 3 row(s) in set (0.013269s)
|
|||
|
||||
- TDengine take influxdb format data and create unique ID for table names by the rule.
|
||||
The user can configure `smlChildTableName` parameter to generate specified table names if he/she needs. And he/she also need to insert data with specified data format.
|
||||
For example, Add `smlChildTableName=tname` in the taos.cfg file. Insert data `st,tname=cpu1,t1=4 c1=3 1626006833639000000` then the table name will be cpu1. If there are multiple lines has same tname but different tag_set, the first line's tag_set will be used to automatically creating table and ignore other lines. Please refer to [TDengine Schemaless](/reference/schemaless/#Schemaless-Line-Protocol)
|
||||
For example, Add `smlChildTableName=tname` in the taos.cfg file. Insert data `st,tname=cpu1,t1=4 c1=3 1626006833639000000` then the table name will be cpu1. If there are multiple lines has same tname but different tag_set, the first line's tag_set will be used to automatically creating table and ignore other lines. Please refer to [TDengine Schemaless](../../reference/schemaless/#Schemaless-Line-Protocol)
|
||||
:::
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ You can write the data collected by collectd to TDengine by simply modifying the
|
|||
|
||||
Writing collectd data to the TDengine requires several preparations.
|
||||
- The TDengine cluster is deployed and running properly
|
||||
- taosAdapter is installed and running, please refer to [taosAdapter's manual](/reference/taosadapter) for details
|
||||
- taosAdapter is installed and running, please refer to [taosAdapter's manual](../../reference/taosadapter) for details
|
||||
- collectd has been installed. Please refer to the [official documentation](https://collectd.org/download.shtml) to install collectd
|
||||
|
||||
## Configuration steps
|
||||
|
|
|
@ -14,7 +14,7 @@ You can write the data collected by icinga2 to TDengine by simply modifying the
|
|||
|
||||
To write icinga2 data to TDengine requires the following preparations.
|
||||
- The TDengine cluster is deployed and working properly
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](/reference/taosadapter) for details.
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](../../reference/taosadapter) for details.
|
||||
- icinga2 has been installed. Please refer to the [official documentation](https://icinga.com/docs/icinga-2/latest/doc/02-installation/) for icinga2 installation
|
||||
|
||||
## Configuration steps
|
||||
|
|
|
@ -14,7 +14,7 @@ You can write the data collected by TCollector to TDengine by simply changing th
|
|||
|
||||
To write data to the TDengine via TCollector requires the following preparations.
|
||||
- The TDengine cluster has been deployed and is working properly
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](/reference/taosadapter) for details.
|
||||
- taosAdapter is installed and running properly. Please refer to the [taosAdapter manual](../../reference/taosadapter) for details.
|
||||
- TCollector has been installed. Please refer to [official documentation](http://opentsdb.net/docs/build/html/user_guide/utilities/tcollector.html#installation-of-tcollector) for TCollector installation
|
||||
|
||||
## Configuration steps
|
||||
|
|
|
@ -82,7 +82,7 @@ Edit the resource configuration to add the key/value pairing for Authorization.
|
|||
Basic cm9vdDp0YW9zZGF0YQ==
|
||||
```
|
||||
|
||||
Please refer to the [ TDengine REST API documentation ](/reference/rest-api/) for the authorization in details.
|
||||
Please refer to the [ TDengine REST API documentation ](../../reference/rest-api/) for the authorization in details.
|
||||
|
||||
Enter the rule engine replacement template in the message body:
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ The output as bellow:
|
|||
|
||||
The role of the TDengine Sink Connector is to synchronize the data of the specified topic to TDengine. Users do not need to create databases and super tables in advance. The name of the target database can be specified manually (see the configuration parameter connection.database), or it can be generated according to specific rules (see the configuration parameter connection.database.prefix).
|
||||
|
||||
TDengine Sink Connector internally uses TDengine [modeless write interface](/reference/connector/cpp#modeless write-api) to write data to TDengine, currently supports data in three formats: [InfluxDB line protocol format](/develop /insert-data/influxdb-line), [OpenTSDB Telnet protocol format](/develop/insert-data/opentsdb-telnet), and [OpenTSDB JSON protocol format](/develop/insert-data/opentsdb-json).
|
||||
TDengine Sink Connector internally uses TDengine [modeless write interface](../../client-libraries/cpp#modeless write-api) to write data to TDengine, currently supports data in three formats: [InfluxDB line protocol format](../../develop/insert-data/influxdb-line), [OpenTSDB Telnet protocol format](../../develop/insert-data/opentsdb-telnet), and [OpenTSDB JSON protocol format](../../develop/insert-data/opentsdb-json).
|
||||
|
||||
The following example synchronizes the data of the topic meters to the target database power. The data format is the InfluxDB Line protocol format.
|
||||
|
||||
|
@ -213,7 +213,7 @@ If you see the above data, the synchronization is successful. If not, check the
|
|||
|
||||
The role of the TDengine Source Connector is to push all the data of a specific TDengine database after a particular time to Kafka. The implementation principle of TDengine Source Connector is to first pull historical data in batches and then synchronize incremental data with the strategy of the regular query. At the same time, the changes in the table will be monitored, and the newly added table can be automatically synchronized. If Kafka Connect is restarted, synchronization will resume where it left off.
|
||||
|
||||
TDengine Source Connector will convert the data in TDengine data table into [InfluxDB Line protocol format](/develop/insert-data/influxdb-line/) or [OpenTSDB JSON protocol format](/develop/insert-data/opentsdb-json ) and then write to Kafka.
|
||||
TDengine Source Connector will convert the data in TDengine data table into [InfluxDB Line protocol format](../../develop/insert-data/influxdb-line/) or [OpenTSDB JSON protocol format](../../develop/insert-data/opentsdb-json ) and then write to Kafka.
|
||||
|
||||
The following sample program synchronizes the data in the database test to the topic tdengine-test-meters.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ sidebar_label: JupyterLab
|
|||
description: This document describes how to integrate TDengine with JupyterLab.
|
||||
---
|
||||
|
||||
JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python connector to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab.
|
||||
JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python client library to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab.
|
||||
|
||||
## Install JupyterLab
|
||||
Installing JupyterLab is very easy. Installation instructions can be found at:
|
||||
|
@ -36,8 +36,8 @@ jupyter lab
|
|||
````
|
||||
This will automatically launch your default browser and connect to your JupyterLab instance, usually on port 8888.
|
||||
|
||||
## Install the TDengine Python connector
|
||||
You can now install the TDengine Python connector as follows.
|
||||
## Install the TDengine Python client library
|
||||
You can now install the TDengine Python client library as follows.
|
||||
|
||||
Start a new Python kernel in JupyterLab.
|
||||
|
||||
|
@ -55,8 +55,8 @@ import sys
|
|||
````
|
||||
|
||||
## Connect to TDengine
|
||||
You can find detailed examples to use the Python connector, in the TDengine documentation here.
|
||||
Once you have installed the TDengine Python connector in your JupyterLab kernel, the process of connecting to TDengine is the same as that you would use if you weren't using JupyterLab.
|
||||
You can find detailed examples to use the Python client library, in the TDengine documentation here.
|
||||
Once you have installed the TDengine Python client library in your JupyterLab kernel, the process of connecting to TDengine is the same as that you would use if you weren't using JupyterLab.
|
||||
Each TDengine instance, has a database called "log" which has monitoring information about the TDengine instance.
|
||||
In the "log" database there is a [supertable](https://docs.tdengine.com/taos-sql/stable/) called "disks_info".
|
||||
|
||||
|
@ -96,4 +96,4 @@ result = sqlQuery(conn)
|
|||
print(result)
|
||||
````
|
||||
|
||||
TDengine has connectors for various languages including Node.js, Go, PHP and there are kernels for these languages which can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels).
|
||||
TDengine has client libraries for various languages including Node.js, Go, PHP and there are kernels for these languages which can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels).
|
||||
|
|
|
@ -19,7 +19,7 @@ To use DBeaver to manage TDengine, you need to prepare the following:
|
|||
|
||||

|
||||
|
||||
2. Configure the TDengine connection by filling in the host address, port number, username, and password. If TDengine is deployed on the local machine, you are only required to fill in the username and password. The default username is root and the default password is taosdata. Click **Test Connection** to check whether the connection is workable. If you do not have the TDengine Java connector installed on the local machine, DBeaver will prompt you to download and install it.
|
||||
2. Configure the TDengine connection by filling in the host address, port number, username, and password. If TDengine is deployed on the local machine, you are only required to fill in the username and password. The default username is root and the default password is taosdata. Click **Test Connection** to check whether the connection is workable. If you do not have the TDengine Java client library installed on the local machine, DBeaver will prompt you to download and install it.
|
||||
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ To connect TDengine using qStudio, you need to complete the following preparatio
|
|||
|
||||

|
||||
|
||||
2. Configure the TDengine connection by entering the host address, port number, username, and password. If TDengine is deployed on the local machine, you can fill in the username and password only. The default username is "root," and the default password is "taosdata." Click "Test" to test the connection's availability. If the TDengine Java connector is not installed on the local machine, qStudio will prompt you to download and install it.
|
||||
2. Configure the TDengine connection by entering the host address, port number, username, and password. If TDengine is deployed on the local machine, you can fill in the username and password only. The default username is "root," and the default password is "taosdata." Click "Test" to test the connection's availability. If the TDengine Java client library is not installed on the local machine, qStudio will prompt you to download and install it.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -10,20 +10,20 @@ description: How to use Seeq and TDengine to perform time series data analysis
|
|||
|
||||
Seeq is an advanced analytics software for the manufacturing industry and the Industrial Internet of Things (IIoT). Seeq supports the use of machine learning innovations within process manufacturing organizations. These capabilities enable organizations to deploy their own or third-party machine learning algorithms into advanced analytics applications used by frontline process engineers and subject matter experts, thus extending the efforts of a single data scientist to many frontline workers.
|
||||
|
||||
TDengine can be added as a data source into Seeq via JDBC connector. Once data source is configured, Seeq can read data from TDengine and offers functionalities such as data visualization, analysis, and forecasting.
|
||||
TDengine can be added as a data source into Seeq via JDBC client library. Once data source is configured, Seeq can read data from TDengine and offers functionalities such as data visualization, analysis, and forecasting.
|
||||
|
||||
## Prerequisite
|
||||
|
||||
1. Install Seeq Server and Seeq Data Lab software
|
||||
2. Install TDengine or register TDengine Cloud service
|
||||
|
||||
## Install TDengine JDBC connector
|
||||
## Install TDengine JDBC client library
|
||||
|
||||
1. Get Seeq data location configuration
|
||||
```
|
||||
sudo seeq config get Folders/Data
|
||||
```
|
||||
2. Download the latest TDengine Java connector from maven.org (current is version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar)), and copy the JAR file into the_directory_found_in_step_1/plugins/lib/
|
||||
2. Download the latest TDengine Java client library from maven.org (current is version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar)), and copy the JAR file into the_directory_found_in_step_1/plugins/lib/
|
||||
3. Restart Seeq server
|
||||
```
|
||||
sudo seeq restart
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
sidebar_label: Power BI
|
||||
title: Power BI
|
||||
description: Use PowerBI and TDengine to analyze time series data
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
With TDengine ODBC driver, PowerBI can access time series data stored in TDengine. You can import tag data, original time series data, or aggregated data into PowerBI from TDengine, to create reports or dashboard without any coding effort.
|
||||
|
||||
## Steps
|
||||

|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. TDengine server has been installed and running well.
|
||||
2. Power BI Desktop has been installed and running. (If not, please download and install latest Windows X64 version from [PowerBI](https://www.microsoft.com/download/details.aspx?id=58494).
|
||||
|
||||
|
||||
## Install Driver
|
||||
|
||||
Depending on your TDengine server version, download appropriate version of TDengine client package from TDengine website [Download Link](https://docs.taosdata.com/get-started/package/), or TDengine explorer if you are using a local TDengine cluster. Install the TDengine client package on same Windows machine where PowerBI is running.
|
||||
|
||||
### Configure Data Source
|
||||
|
||||
Please refer to [ODBC](../../client-libraries/odbc) to configure TDengine ODBC Driver with WebSocket connection.
|
||||
|
||||
### Import Data from TDengine to Power BI
|
||||
|
||||
1. Open Power BI and logon, add data source following steps "Home Page" -> "Get Data" -> "Others" -> "ODBC" -> "Connect"
|
||||
|
||||
2. Choose data source name, connect to configured data source, go to the nativator, browse tables of the selected database and load data
|
||||
|
||||
3. If you want to input some specific SQL, click "Advanced Options", and input your SQL in the open dialogue box and load the data.
|
||||
|
||||
|
||||
To better use Power BI to analyze the data stored in TDengine, you need to understand the concepts of dimention, metric, time serie, correlation, and use your own SQL to import data.
|
||||
|
||||
1. Dimention: it's normally category (text) data to describe such information as device, collection point, model. In the supertable template of TDengine, we use tag columns to store the dimention information. You can use SQL like `select distinct tbname, tag1, tag2 from supertable` to get dimentions.
|
||||
|
||||
2. Metric: quantitive (numeric) fileds that can be calculated, like SUM, AVERAGE, MINIMUM. If the collecting frequency is 1 second, then there are 31,536,000 records in one year, it will be too low efficient to import so big data into Power BI. In TDengine, you can use data partition query, window partition query, in combination with pseudo columns related to window, to import downsampled data into Power BI. For more details, please refer to [TDengine Specialized Queries](https://docs.taosdata.com/taos-sql/distinguished/)。
|
||||
|
||||
- Window partition query: for example, thermal meters collect one data per second, but you need to query the average temperature every 10 minutes, you can use window subclause to get the downsampling data you need. The corresponding SQL is like `select tbname, _wstart date,avg(temperature) temp from table interval(10m)`, in which _wstart is a pseudo column indicting the start time of a widow, 10m is the duration of the window, `avg(temperature)` indicates the aggregate value inside a window.
|
||||
|
||||
- Data partition query: If you want to get the aggregate value of a lot of thermal meters, you can first partition the data and then perform a series of calculation in the partitioned data spaces. The SQL you need to use is `partition by part_list`. The most common of data partition usage is that when querying a supertable, you can partition data by subtable according to tags to form the data of each subtable into a single time serie to facilitate analytical processing of time series data.
|
||||
|
||||
3. Time Serie: When curve plotting or aggregating data based on time lines, date is normally required. Data or time can be imported from Excel, or retrieved from TDengine using SQL statement like `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`, in which the fill() subclause indicates the fill mode when there is data missing, pseudo column _wstart indicates the date to retrieve.
|
||||
|
||||
4. Correlation: Indicates how to correlate data. Dimentions and Metrics can be correlated by tbname, dates and metrics can be correlated by date. All these can cooperate to form visual reports.
|
||||
|
||||
### Example - Meters
|
||||
|
||||
TDengine has its own specific data model, which uses supertable as template and creates a specific table for each device. Each table can have maximum 4,096 data columns and 128 tags. In the example of meters, assume each meter generates one record per second, then there will be 86,400 records each day and 31,536,000 records every year, then only 1,000 meters will occupy 500GB disk space. So, the common usage of Power BI should be mapping tags to dimention columns, mapping the aggregation of data columns to metric columns, to provide indicators for decision makers.
|
||||
|
||||
1. Import Dimentions
|
||||
|
||||
Import the tags of tables in PowerBI, and name as "tags", the SQL is like `select distinct tbname, groupid, location from test.meters;`.
|
||||
|
||||
2. Import Metrics
|
||||
|
||||
In Power BI, import the average current, average voltage, average phase with 1 hour window, and name it as "data", the SQL is like `select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)` .
|
||||
|
||||
3. Correlate Dimentions and Metrics
|
||||
|
||||
In Power BI, open model view, correlate "tags" and "data", and set "tabname" as the correlation column, then you can use the data in histogram, pie chart, etc. For more information about building visual reports in PowerBI, please refer to [Power BI](https://learn.microsoft.com/power-bi/)。
|
|
@ -14,4 +14,4 @@ Check the running status of taosAdapter.
|
|||
systemctl status taosadapter
|
||||
```
|
||||
|
||||
taosAdapter Please refer to the `taosadapter --help` command output and [reference documentation](/reference/taosadapter) for detailed configuration parameters and usage of taosAdapter.
|
||||
taosAdapter Please refer to the `taosadapter --help` command output and [reference documentation](../../reference/taosadapter) for detailed configuration parameters and usage of taosAdapter.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
|
@ -41,7 +41,7 @@ Download and install the [latest version of TDengine](https://docs.tdengine.com/
|
|||
|
||||
### Install Grafana Plugin and Configure Data Source
|
||||
|
||||
Please refer to [Install Grafana Plugin and Configure Data Source](/third-party/grafana/#install-grafana-plugin-and-configure-data-source)
|
||||
Please refer to [Install Grafana Plugin and Configure Data Source](../../third-party/grafana/#install-grafana-plugin-and-configure-data-source)
|
||||
|
||||
### Modify /etc/telegraf/telegraf.conf
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue