Skip to main content

Native API Comparison

...About 3 min

Native API Comparison

This chapter mainly compares the differences between Java Native API and python native API, mainly for the convenience of distinguishing the differences between Java Native API and python native API.

OrderAPI name and functionJava APIPython API
API Comparison
1Initialize 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. The python native API lacks the default configuration to initialize the session
2. The python native API is missing the initialization session of specifying multiple connectable nodes
3. The python native API is missing. Use other configuration items to initialize the session
2Open sessionvoid open() void open(boolean enableRPCCompression)session.open(enable_rpc_compression=False)
3Close sessionvoid close()session.close()
4Create Databasevoid setStorageGroup(String storageGroupId)session.set_storage_group(group_name)
5Delete databasevoid deleteStorageGroup(String storageGroup) void deleteStorageGroups(List<String> storageGroups)session.delete_storage_group(group_name) session.delete_storage_groups(group_name_lst)
6Create timeseriesvoid 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)
7Create aligned timeseriesvoid 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)
8Delete timeseriesvoid deleteTimeseries(String path) void deleteTimeseries(List<String> paths)session.delete_time_series(paths_list)Python native API is missing an API to delete a time series
9Detect whether the timeseries existsboolean checkTimeseriesExists(String path)session.check_time_series_exists(path)
10Schema templatepublic void createSchemaTemplate(Template template);
11Insert tabletvoid insertTablet(Tablet tablet) void insertTablets(Map<String, Tablet> tablets)session.insert_tablet(tablet_) session.insert_tablets(tablet_lst)
12Insert 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_, data_types_, values_) session.insert_records(device_ids_, time_list_, measurements_list_, data_type_list_, values_list_) session.insert_records_of_one_device(device_id, time_list, measurements_list, data_types_list, values_list)
13Write with type inferencevoid 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. The python native API lacks an API for inserting multiple records
2. The python native API lacks the ability to insert multiple records belonging to the same device
14Write of aligned time seriesinsertAlignedRecord insertAlignedRecords insertAlignedRecordsOfOneDevice insertAlignedStringRecordsOfOneDevice insertAlignedTablet insertAlignedTabletsinsert_aligned_record insert_aligned_records insert_aligned_records_of_one_device insert_aligned_tablet insert_aligned_tabletsPython native API is missing the writing of aligned time series with judgment type
15Data deletionvoid deleteData(String path, long endTime) void deleteData(List<String> paths, long endTime)1. The python native API lacks an API to delete a piece of data
2. The python native API lacks an API to delete multiple pieces of data
16Data querySessionDataSet executeRawDataQuery(List<String> paths, long startTime, long endTime) SessionDataSet executeLastDataQuery(List<String> paths, long LastTime)1. The python native API lacks an API for querying the original data
2. The python native API lacks an API to query the data whose last timestamp is greater than or equal to a certain time point
17Iotdb SQL API - query statementSessionDataSet executeQueryStatement(String sql)session.execute_query_statement(sql)
18Iotdb SQL API - non query statementvoid executeNonQueryStatement(String sql)session.execute_non_query_statement(sql)
19Test APIvoid 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 client support for testing is based on the testcontainers libraryPython API has no native test API
20Connection pool for native interfacesSessionPoolPython API has no connection pool for native API
21API related to cluster informationiotdb-thrift-clusterPython API does not support interfaces related to cluster information

Copyright © 2024 The Apache Software Foundation.
Apache and the Apache feather logo are trademarks of The Apache Software Foundation

Have a question? Connect with us on QQ, WeChat, or Slack. Join the community now.