From 46b3927e07f31a6aedb47753df3ea21ad184aff6 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 29 Jun 2021 16:23:45 +0800 Subject: [PATCH] Docs/sangshuduo/td 4752 python nanosecond (#6664) * [TD-4752]: python connector supports nanoseconds. * update english document too. --- documentation20/cn/08.connector/docs.md | 2 +- documentation20/en/08.connector/docs.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md index 454d896fc2..762d1ad480 100644 --- a/documentation20/cn/08.connector/docs.md +++ b/documentation20/cn/08.connector/docs.md @@ -557,7 +557,7 @@ c1.close() conn.close() ``` -#### 关于纳秒 (nanosecon) 在 Python 连接器中的说明 +#### 关于纳秒 (nanosecond) 在 Python 连接器中的说明 由于目前 Python 对 nanosecond 支持的不完善(参见链接 1. 2. ),目前的实现方式是在 nanosecond 精度时返回整数,而不是 ms 和 us 返回的 datetime 类型,应用开发者需要自行处理,建议使用 pandas 的 to_datetime()。未来如果 Python 正式完整支持了纳秒,涛思数据可能会修改相关接口。 diff --git a/documentation20/en/08.connector/docs.md b/documentation20/en/08.connector/docs.md index 3da9937f98..9b3940a2e8 100644 --- a/documentation20/en/08.connector/docs.md +++ b/documentation20/en/08.connector/docs.md @@ -515,6 +515,13 @@ c1.close() conn.close() ``` +#### Using nanosecond in Python connector + +So far Python still does not completely support nanosecond type. Please refer to the link 1 and 2. The implementation of the python connector is to return an integer number for nanosecond value rather than datatime type as what ms and us do. The developer needs to handle it themselves. We recommend using pandas to_datetime() function. If Python officially support nanosecond in the future, TAOS Data might be possible to change the interface accordingly, which mean the application need change too. + +1. https://stackoverflow.com/questions/10611328/parsing-datetime-strings-containing-nanoseconds +2. https://www.python.org/dev/peps/pep-0564/ + #### Helper Users can directly view the usage information of the module through Python's helper, or refer to the sample program in tests/examples/Python. The following are some common classes and methods: