原生接口对比

此章节主要为Java原生接口与Python原生接口的差异性对比,主要为方便区分Java原生接口与Python原生的不同之处。

序号接口名称以及作用Java接口函数Python接口函数
接口对比说明
1初始化SessionSession.Builder.build(); Session.Builder().host(String host).port(int port).build(); Session.Builder().nodeUrls(List<String> nodeUrls).build(); Session.Builder().fetchSize(int fetchSize).username(String username).password(String password).thriftDefaultBufferSize(int thriftDefaultBufferSize).thriftMaxFrameSize(int thriftMaxFrameSize).enableRedirection(boolean enableCacheLeader).version(Version version).build();Session(ip, port, username, password,fetch_size=1024, zone_id=”UTC+8”)1.Python原生接口缺少使用默认配置初始化session 2.Python原生接口缺少指定多个可连接节点初始化session 3.Python原生接口缺失使用其他配置项初始化session
2开启 Sessionvoid open() void open(boolean enableRPCCompression)session.open(enable_rpc_compression=False)
3关闭 Sessionvoid close()session.close()
4设置 Databasevoid setStorageGroup(String storageGroupId)session.set_storage_group(group_name)
5删除 databasevoid deleteStorageGroup(String storageGroup) void deleteStorageGroups(List<String> storageGroups)session.delete_storage_group(group_name) session.delete_storage_groups(group_name_lst)
6创建时间序列void createTimeseries(String path, TSDataType dataType,TSEncoding encoding, CompressionType compressor, Map<String, String> props,Map<String, String> tags, Map<String, String> attributes, String measurementAlias) void createMultiTimeseries(List<String> paths, List<TSDataType> dataTypes,List<TSEncoding> encodings, List<CompressionType> compressors,List<Map<String, String>> propsList, List<Map<String, String>> tagsList,List<Map<String, String>> attributesList, List<String> measurementAliasList)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)
7创建对齐时间序列void createAlignedTimeseries(String prefixPath, List<String> measurements,List<TSDataType> dataTypes, List<TSEncoding> encodings,CompressionType compressor, List<String> measurementAliasList);session.create_aligned_time_series(device_id, measurements_lst, data_type_lst, encoding_lst, compressor_lst)
8删除时间序列void deleteTimeseries(String path) void deleteTimeseries(List<String> paths)session.delete_time_series(paths_list)Python原生接口缺少删除一个时间序列的接口
9检测时间序列是否存在boolean checkTimeseriesExists(String path)session.check_time_series_exists(path)
10元数据模版public void createSchemaTemplate(Template template);
11插入Tabletvoid insertTablet(Tablet tablet) void insertTablets(Map<String, Tablet> tablets)session.insert_tablet(tablet) session.inserttablets(tablet_lst)
12插入Recordvoid insertRecord(String prefixPath, long time, List<String> measurements,List<TSDataType> types, List<Object> values) void insertRecords(List<String> deviceIds,List<Long> times,List<List<String>> measurementsList,List<List<TSDataType>> typesList,List<List<Object>> valuesList) void insertRecordsOfOneDevice(String deviceId, List<Long> times,List<List<Object>> valuesList)session.insert_record(device_id, timestamp, measurements, datatypes, values) session.insert_records(device_ids, timelist, measurementslist, datatype_list, valueslist) session.insert_records_of_one_device(device_id, time_list, measurements_list, data_types_list, values_list)
13带有类型推断的写入void insertRecord(String prefixPath, long time, List<String> measurements, List<String> values) void insertRecords(List<String> deviceIds, List<Long> times,List<List<String>> measurementsList, List<List<String>> valuesList) void insertStringRecordsOfOneDevice(String deviceId, List<Long> times,List<List<String>> measurementsList, List<List<String>> valuesList)session.insert_str_record(device_id, timestamp, measurements, string_values)1.Python原生接口缺少插入多个 Record的接口 2.Python原生接口缺少插入同属于一个 device 的多个 Record
14对齐时间序列的写入insertAlignedRecord insertAlignedRecords insertAlignedRecordsOfOneDevice insertAlignedStringRecordsOfOneDevice insertAlignedTablet insertAlignedTabletsinsert_aligned_record insert_aligned_records insert_aligned_records_of_one_device insert_aligned_tablet insert_aligned_tabletsPython原生接口缺少带有判断类型的对齐时间序列的写入
15数据删除void deleteData(String path, long endTime) void deleteData(List<String> paths, long endTime)1.Python原生接口缺少删除一条数据的接口 2.Python原生接口缺少删除多条数据的接口
16数据查询SessionDataSet executeRawDataQuery(List<String> paths, long startTime, long endTime) SessionDataSet executeLastDataQuery(List<String> paths, long LastTime)1.Python原生接口缺少原始数据查询的接口 2.Python原生接口缺少查询最后一条时间戳大于等于某个时间点的数据的接口
17IoTDB-SQL 接口-查询语句SessionDataSet executeQueryStatement(String sql)session.execute_query_statement(sql)
18IoTDB-SQL 接口-非查询语句void executeNonQueryStatement(String sql)session.execute_non_query_statement(sql)
19测试接口void testInsertRecord(String deviceId, long time, List<String> measurements, List<String> values) void testInsertRecord(String deviceId, long time, List<String> measurements,List<TSDataType> types, List<Object> values) void testInsertRecords(List<String> deviceIds, List<Long> times,List<List<String>> measurementsList, List<List<String>> valuesList) void testInsertRecords(List<String> deviceIds, List<Long> times,List<List<String>> measurementsList, List<List<TSDataType>> typesList,List<List<Object>> valuesList) void testInsertTablet(Tablet tablet) void testInsertTablets(Map<String, Tablet> tablets)Python 客户端对测试的支持是基于testcontainers库Python接口无原生的测试接口
20针对原生接口的连接池SessionPoolPython接口无针对原生接口的连接池
21集群信息相关的接口iotdb-thrift-clusterPython接口不支持集群信息相关的接口