<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Apache IoTDB
[![Python Client](https://github.com/apache/iotdb/actions/workflows/client-python.yml/badge.svg?branch=master)](https://github.com/apache/iotdb/actions/workflows/client-python.yml)
[![GitHub release](https://img.shields.io/github/release/apache/iotdb.svg)](https://github.com/apache/iotdb/releases)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
![](https://github-size-badge.herokuapp.com/apache/iotdb.svg)
![](https://img.shields.io/github/downloads/apache/iotdb/total.svg)
![](https://img.shields.io/badge/platform-win%20%7C%20macos%20%7C%20linux-yellow.svg)
[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/)
Apache IoTDB (Database for Internet of Things) is an IoT native database with high performance for
data management and analysis, deployable on the edge and the cloud. Due to its light-weight
architecture, high performance and rich feature set together with its deep integration with
Apache Hadoop, Spark and Flink, Apache IoTDB can meet the requirements of massive data storage,
high-speed data ingestion and complex data analysis in the IoT industrial fields.
## Python Native API
### Requirements
You have to install thrift (>=0.13) before using the package.
### How to use (Example)
First, download the latest package: `pip3 install apache-iotdb`
*Notice: If you are installing Python API v0.13.0, DO NOT install by `pip install apache-iotdb==0.13.0`, use `pip install apache-iotdb==0.13.0.post1` instead!*
You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/client-py/SessionExample.py)
An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/client-py/SessionAlignedTimeseriesExample.py)
(you need to add `import iotdb` in the head of the file)
Or:
```python
from iotdb.Session import Session
ip = "127.0.0.1"
port_ = "6667"
username_ = "root"
password_ = "root"
session = Session(ip, port_, username_, password_)
session.open(False)
zone = session.get_time_zone()
session.close()
```
### Initialization
* Initialize a Session
```python
session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
```
* Open a session, with a parameter to specify whether to enable RPC compression
```python
session.open(enable_rpc_compression=False)
```
Notice: this RPC compression status of client must comply with that of IoTDB server
* Close a Session
```python
session.close()
```
### Data Definition Interface (DDL Interface)
#### DATABASE Management
* CREATE DATABASE
```python
session.set_storage_group(group_name)
```
* Delete one or several databases
```python
session.delete_storage_group(group_name)
session.delete_storage_groups(group_name_lst)
```
#### Timeseries Management
* Create one or multiple timeseries
```python
session.create_time_series(ts_path, data_type, encoding, compressor,
props=None, tags=None, attributes=None, alias=None)
session.create_multi_time_series(
ts_path_lst, data_type_lst, encoding_lst, compressor_lst,
props_lst=None, tags_lst=None, attributes_lst=None, alias_lst=None
)
```
* Create aligned timeseries
```python
session.create_aligned_time_series(
device_id, measurements_lst, data_type_lst, encoding_lst, compressor_lst
)
```
Attention: Alias of measurements are **not supported** currently.
* Delete one or several timeseries
```python
session.delete_time_series(paths_list)
```
* Check whether the specific timeseries exists
```python
session.check_time_series_exists(path)
```
### Data Manipulation Interface (DML Interface)
#### Insert
It is recommended to use insertTablet to help improve write efficiency.
* Insert a Tablet,which is multiple rows of a device, each row has the same measurements
* **Better Write Performance**
* **Support null values**: fill the null value with any value, and then mark the null value via BitMap (from v0.13)
We have two implementations of Tablet in Python API.
* Normal Tablet
```python
values_ = [
[False, 10, 11, 1.1, 10011.1, "test01"],
[True, 100, 11111, 1.25, 101.0, "test02"],
[False, 100, 1, 188.1, 688.25, "test03"],
[True, 0, 0, 0, 6.25, "test04"],
]
timestamps_ = [1, 2, 3, 4]
tablet_ = Tablet(
device_id, measurements_, data_types_, values_, timestamps_
)
session.insert_tablet(tablet_)
values_ = [
[None, 10, 11, 1.1, 10011.1, "test01"],
[True, None, 11111, 1.25, 101.0, "test02"],
[False, 100, None, 188.1, 688.25, "test03"],
[True, 0, 0, 0, None, None],
]
timestamps_ = [16, 17, 18, 19]
tablet_ = Tablet(
device_id, measurements_, data_types_, values_, timestamps_
)
session.insert_tablet(tablet_)
```
* Numpy Tablet
Comparing with Tablet, Numpy Tablet is using [numpy.ndarray](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) to record data.
With less memory footprint and time cost of serialization, the insert performance will be better.
**Notice**
1. time and value columns in Tablet are ndarray.
2. recommended to use the specific dtypes to each ndarray, see the example below
(if not, the default dtypes are also ok).
```python
import numpy as np
data_types_ = [
TSDataType.BOOLEAN,
TSDataType.INT32,
TSDataType.INT64,
TSDataType.FLOAT,
TSDataType.DOUBLE,
TSDataType.TEXT,
]
np_values_ = [
np.array([False, True, False, True], TSDataType.BOOLEAN.np_dtype()),
np.array([10, 100, 100, 0], TSDataType.INT32.np_dtype()),
np.array([11, 11111, 1, 0], TSDataType.INT64.np_dtype()),
np.array([1.1, 1.25, 188.1, 0], TSDataType.FLOAT.np_dtype()),
np.array([10011.1, 101.0, 688.25, 6.25], TSDataType.DOUBLE.np_dtype()),
np.array(["test01", "test02", "test03", "test04"], TSDataType.TEXT.np_dtype()),
]
np_timestamps_ = np.array([1, 2, 3, 4], TSDataType.INT64.np_dtype())
np_tablet_ = NumpyTablet(
device_id, measurements_, data_types_, np_values_, np_timestamps_
)
session.insert_tablet(np_tablet_)
# insert one numpy tablet with none into the database.
np_values_ = [
np.array([False, True, False, True], TSDataType.BOOLEAN.np_dtype()),
np.array([10, 100, 100, 0], TSDataType.INT32.np_dtype()),
np.array([11, 11111, 1, 0], TSDataType.INT64.np_dtype()),
np.array([1.1, 1.25, 188.1, 0], TSDataType.FLOAT.np_dtype()),
np.array([10011.1, 101.0, 688.25, 6.25], TSDataType.DOUBLE.np_dtype()),
np.array(["test01", "test02", "test03", "test04"], TSDataType.TEXT.np_dtype()),
]
np_timestamps_ = np.array([98, 99, 100, 101], TSDataType.INT64.np_dtype())
np_bitmaps_ = []
for i in range(len(measurements_)):
np_bitmaps_.append(BitMap(len(np_timestamps_)))
np_bitmaps_[0].mark(0)
np_bitmaps_[1].mark(1)
np_bitmaps_[2].mark(2)
np_bitmaps_[4].mark(3)
np_bitmaps_[5].mark(3)
np_tablet_with_none = NumpyTablet(
device_id, measurements_, data_types_, np_values_, np_timestamps_, np_bitmaps_
)
session.insert_tablet(np_tablet_with_none)
```
* Insert multiple Tablets
```python
session.insert_tablets(tablet_lst)
```
*
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
时间序列分析 一个时间序列通常由4种要素组成:趋势、季节变动、循环波动和不规则波动。 趋势:是时间序列在长时期内呈现出来的持续向上或持续向下的变动。 季节变动:是时间序列在一年内重复出现的周期性波动。它是诸如气候条件、生产条件、节假日或人们的风俗习惯等各种因素影响的结果。 循环波动:是时间序列呈现出得非固定长度的周期性变动。循环波动的周期可能会持续一段时间,但与趋势不同,它不是朝着单一方向的持续变动,而是涨落相同的交替波动。 不规则波动:是时间序列中除去趋势、季节变动和周期波动之后的随机波动。不规则波动通常总是夹杂在时间序列中,致使时间序列产生一种波浪形或震荡式的变动。只含有随机波动的序列也称为平稳序列。 时间序列建模基本步骤是:①用观测、调查、统计、抽样等方法取得被观测系统时间序列动态数据。②根据动态数据作相关图,进行相关分析,求自相关函数。相关图能显示出变化的趋势和周期,并能发现跳点和拐点。跳点是指与其他数据不一致的观测值。如果跳点是正确的观测值,在建模时应考虑进去,如果是反常现象,则应把跳点调整到期望值。拐点则是指时间序列从上升趋势突然变为下降趋势的点。
资源推荐
资源详情
资源评论
收起资源包目录
IoTDB 是针对时间序列数据收集、存储与分析一体化的数据管理引擎.zip (2000个子文件)
plugin.go 14KB
iotdb_resource_handler.go 5KB
main.go 2KB
Magefile.go 1KB
FastNonAlignedCrossCompactionTest.java 335KB
ReadPointAlignedCrossCompactionTest.java 329KB
FastAlignedCrossCompactionTest.java 329KB
ReadPointNonAlignedCrossCompactionTest.java 328KB
ReadPointCompactionPerformerTest.java 259KB
FastCrossCompactionPerformerTest.java 172KB
CrossSpaceCompactionWithFastPerformerValidationTest.java 124KB
CrossSpaceCompactionWithReadPointPerformerValidationTest.java 117KB
ClusterConfigTaskExecutor.java 104KB
ClientRPCServiceImpl.java 102KB
InsertionCrossSpaceCompactionSelectorTest.java 99KB
MergeSortOperatorTest.java 85KB
CrossSpaceCompactionSelectorTest.java 81KB
FastInnerCompactionPerformerTest.java 79KB
DataNodeInternalRPCServiceImpl.java 76KB
CompactionSchedulerTest.java 74KB
CompactionSchedulerWithFastPerformerTest.java 74KB
TopKOperatorTest.java 73KB
OperatorMemoryTest.java 69KB
InnerSeqCompactionWithFastPerformerTest.java 63KB
AlignedByDeviceTest.java 62KB
InnerSeqCompactionWithReadChunkPerformerTest.java 61KB
SizeTieredCompactionRecoverTest.java 60KB
InnerUnseqCompactionWithFastPerformerTest.java 60KB
DataRegionTest.java 59KB
AlignByDeviceOrderByLimitOffsetTest.java 59KB
ReadChunkCompactionPerformerNoAlignedTest.java 56KB
AnalyzeTest.java 55KB
SchemaRegionPBTreeImpl.java 55KB
SeriesScanUtil.java 55KB
SeriesScanCostMetricSet.java 54KB
MTreeBelowSGCachedImpl.java 54KB
PipelineBuilderTest.java 53KB
SchemaRegionMemoryImpl.java 53KB
InnerTimeJoinOperatorTest.java 53KB
CrossSpaceCompactionWithFastPerformerTest.java 51KB
CrossSpaceCompactionWithReadPointPerformerTest.java 50KB
MultiTsFileDeviceIteratorTest.java 50KB
LinearFillOperatorTest.java 48KB
RegionWriteExecutor.java 48KB
InnerUnseqCompactionWithReadPointPerformerTest.java 47KB
MTreeBelowSGMemoryImpl.java 47KB
RawDataAggregationOperatorTest.java 46KB
AlignedTVList.java 46KB
SizeTieredCompactionRecoverTest.java 45KB
QueryLogicalPlanUtil.java 44KB
RewriteCompactionFileSelectorTest.java 43KB
SerializeUtilsTest.java 43KB
AggregationDistributionTest.java 43KB
SchemaRegionBasicTest.java 43KB
FastCompactionPerformerNoAlignedTest.java 42KB
RewriteCrossSpaceCompactionRecoverTest.java 42KB
PageManager.java 42KB
AccumulatorTest.java 40KB
IoTConsensusServerImpl.java 40KB
SchemaFileTest.java 40KB
ClusterSchemaTreeTest.java 38KB
ConfigNodeClient.java 38KB
DataNode.java 38KB
AlignedSeriesScanOperatorTest.java 37KB
CrossSpaceCompactionWithUnusualCasesTest.java 37KB
CrossSpaceCompactionExceptionTest.java 37KB
ReadChunkInnerCompactionTest.java 36KB
StatementGeneratorTest.java 35KB
CompactionMetrics.java 35KB
LogicalPlannerTest.java 35KB
RewriteCrossSpaceCompactionWithReadPointPerformerTest.java 35KB
RewriteCrossSpaceCompactionWithFastPerformerTest.java 35KB
MPPDataExchangeManager.java 34KB
PartitionCache.java 34KB
RatisConfig.java 33KB
AlignedSeriesAggregationScanOperatorTest.java 33KB
LoadTsfileAnalyzer.java 33KB
TsFileInsertionDataContainerTest.java 32KB
QueryExecution.java 32KB
TsFilePlanRedoerTest.java 32KB
ReadChunkCompactionPerformerAlignedTest.java 32KB
RatisConsensus.java 31KB
IoTDBRestServiceTest.java 30KB
ExpressionAnalyzer.java 30KB
WritingMetrics.java 30KB
SourceHandleTest.java 30KB
InnerSpaceCompactionSelectorTest.java 30KB
QueryDataSetUtils.java 29KB
ConsensusReqReaderTest.java 29KB
WrappedSegment.java 29KB
ColumnInjectionPushDownTest.java 29KB
SeriesAggregationScanOperatorTest.java 28KB
LeftOuterTimeJoinOperatorTest.java 28KB
FastCompactionPerformerAlignedTest.java 28KB
DateTimeUtils.java 28KB
AbstractCompactionTest.java 28KB
AutoCreateSchemaExecutor.java 28KB
TsFileValidationTool.java 27KB
SchemaStatisticsTest.java 27KB
IoTDBThriftReceiverV1.java 27KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
野生的狒狒
- 粉丝: 2533
- 资源: 2149
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- n.cpp
- jdk-8u411-windows-x64下载安装可用
- vgg模型-图像分类算法对水果识别-不含数据集图片-含逐行注释和说明文档.zip
- KMP算法(Knuth-Morris-Pratt算法
- vgg模型-python语言pytorch框架训练识别化妆品分类-不含数据集图片-含逐行注释和说明文档.zip
- KMP算法(Knuth-Morris-Pratt算法
- shufflenet模型-基于人工智能的卷积网络训练识别狗的表情-不含数据集图片-含逐行注释和说明文档.zip
- shufflenet模型-python语言pytorch框架训练识别张嘴闭嘴-不含数据集图片-含逐行注释和说明文档.zip
- resnet模型-基于人工智能的卷积网络训练识别面部表情识别-不含数据集图片-含逐行注释和说明文档
- resnet模型-python语言pytorch框架训练识别香蕉品质-不含数据集图片-含逐行注释和说明文档.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功