Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7d2f2e3a
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d2f2e3a
编写于
7月 31, 2022
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2.6' into feat/sangshuduo/TD-14141-update-taostools-for2.6
上级
b0132991
2e6c9c64
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
74 addition
and
7 deletion
+74
-7
docs/en/14-reference/03-connector/python.mdx
docs/en/14-reference/03-connector/python.mdx
+15
-0
docs/examples/python/conn_native_pandas.py
docs/examples/python/conn_native_pandas.py
+3
-3
docs/examples/python/conn_native_sqlalchemy.py
docs/examples/python/conn_native_sqlalchemy.py
+19
-0
docs/examples/python/conn_rest_pandas.py
docs/examples/python/conn_rest_pandas.py
+3
-3
docs/examples/python/conn_rest_sqlalchemy.py
docs/examples/python/conn_rest_sqlalchemy.py
+19
-0
docs/zh/14-reference/03-connector/python.mdx
docs/zh/14-reference/03-connector/python.mdx
+14
-0
src/plugins/CMakeLists.txt
src/plugins/CMakeLists.txt
+1
-1
未找到文件。
docs/en/14-reference/03-connector/python.mdx
浏览文件 @
7d2f2e3a
...
...
@@ -293,6 +293,21 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
{{#include docs/examples/python/conn_rest_pandas.py}}
```
</TabItem>
<Tabs default="native+sqlalchemy">
<TabItem value="native" label="原生连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_native_sqlalchemy.py}}
```
</TabItem>
<TabItem value="rest+sqlalchemy" label="REST 连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_rest_sqlachemy.py}}
```
</TabItem>
</Tabs>
...
...
docs/examples/python/conn_native_pandas.py
浏览文件 @
7d2f2e3a
import
taos
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taos://root:taosdata@localhost:6030/power"
)
df
=
pandas
.
read_sql
(
"SELECT * FROM meters"
,
engine
)
conn
=
taos
.
connect
(
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM meters"
,
conn
)
# print index
print
(
df
.
index
)
...
...
docs/examples/python/conn_native_sqlalchemy.py
0 → 100644
浏览文件 @
7d2f2e3a
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taos://root:taosdata@localhost:6030/power"
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
engine
)
# print index
print
(
df
.
index
)
# print data type of element in ts column
print
(
type
(
df
.
ts
[
0
]))
print
(
df
.
head
(
3
))
# output:
# RangeIndex(start=0, stop=8, step=1)
# <class 'pandas._libs.tslibs.timestamps.Timestamp'>
# ts current ... location groupid
# 0 2018-10-03 14:38:05.500 11.8 ... california.losangeles 2
# 1 2018-10-03 14:38:16.600 13.4 ... california.losangeles 2
# 2 2018-10-03 14:38:05.000 10.8 ... california.losangeles 3
docs/examples/python/conn_rest_pandas.py
浏览文件 @
7d2f2e3a
import
taosrest
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taosrest://root:taosdata@localhost:6041"
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
engine
)
conn
=
taosrest
.
connect
(
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
conn
)
# print index
print
(
df
.
index
)
...
...
docs/examples/python/conn_rest_sqlalchemy.py
0 → 100644
浏览文件 @
7d2f2e3a
import
pandas
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
"taosrest://root:taosdata@localhost:6041"
)
df
:
pandas
.
DataFrame
=
pandas
.
read_sql
(
"SELECT * FROM power.meters"
,
engine
)
# print index
print
(
df
.
index
)
# print data type of element in ts column
print
(
type
(
df
.
ts
[
0
]))
print
(
df
.
head
(
3
))
# output:
# RangeIndex(start=0, stop=8, step=1)
# <class 'pandas._libs.tslibs.timestamps.Timestamp'>
# ts current ... location groupid
# 0 2018-10-03 06:38:05.500000+00:00 11.8 ... california.losangeles 2
# 1 2018-10-03 06:38:16.600000+00:00 13.4 ... california.losangeles 2
# 2 2018-10-03 06:38:05+00:00 10.8 ... california.losangeles 3
docs/zh/14-reference/03-connector/python.mdx
浏览文件 @
7d2f2e3a
...
...
@@ -295,6 +295,20 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
{{#include docs/examples/python/conn_rest_pandas.py}}
```
</TabItem>
<TabItem value="native+sqlalchemy" label="原生连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_native_sqlalchemy.py}}
```
</TabItem>
<TabItem value="rest+sqlalchemy" label="REST 连接 + SQLAlchemy">
```python
{{#include docs/examples/python/conn_rest_sqlachemy.py}}
```
</TabItem>
</Tabs>
...
...
src/plugins/CMakeLists.txt
浏览文件 @
7d2f2e3a
...
...
@@ -63,7 +63,7 @@ ELSE ()
COMMAND CGO_CFLAGS=-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc CGO_LDFLAGS=-L
${
CMAKE_BINARY_DIR
}
/build/lib go build -a -ldflags
"-s -w -X github.com/taosdata/taosadapter/version.Version=
${
taos_version
}
-X github.com/taosdata/taosadapter/version.CommitID=
${
taosadapter_commit_sha1
}
"
COMMAND CGO_CFLAGS=-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc CGO_LDFLAGS=-L
${
CMAKE_BINARY_DIR
}
/build/lib go build -a -o taosadapter-debug -ldflags
"-X github.com/taosdata/taosadapter/version.Version=
${
taos_version
}
-X github.com/taosdata/taosadapter/version.CommitID=
${
taosadapter_commit_sha1
}
"
INSTALL_COMMAND
COMMAND wget -c https://github.com/upx/upx/releases/download/v3.96/upx-3.96-
${
PLATFORM_ARCH_STR
}
_linux.tar.xz -O
$
{
CMAKE_CURRENT_SOURCE_DIR
}
/upx.tar.xz && tar -xvJf
${
CMAKE_CURRENT_SOURCE_DIR
}
/upx.tar.xz -C
${
CMAKE_CURRENT_SOURCE_DIR
}
--strip-components 1 > /dev/null &&
${
CMAKE_CURRENT_SOURCE_DIR
}
/upx taosadapter || :
COMMAND wget -c https://github.com/upx/upx/releases/download/v3.96/upx-3.96-
${
PLATFORM_ARCH_STR
}
_linux.tar.xz -O $
ENV{HOME}/upx.tar.xz && tar -xvJf $ENV{HOME}/upx.tar.xz -C $ENV{HOME} --strip-components 1 > /dev/null && $ENV{HOME
}/upx taosadapter || :
COMMAND cmake -E copy taosadapter
${
CMAKE_BINARY_DIR
}
/build/bin
COMMAND cmake -E make_directory
${
CMAKE_BINARY_DIR
}
/test/cfg/
COMMAND cmake -E copy ./example/config/taosadapter.toml
${
CMAKE_BINARY_DIR
}
/test/cfg/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录