blob: 40a54b07deedd4370cc80a0d8f84cefd80715108 [file] [log] [blame]
(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{424:function(t,e,i){"use strict";i.r(e);var s=i(29),n=Object(s.a)({},(function(){var t=this,e=t._self._c;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"native-api-comparison"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#native-api-comparison"}},[t._v("#")]),t._v(" Native API Comparison")]),t._v(" "),e("p",[t._v("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.")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Order")]),t._v(" "),e("th",[t._v("API name and function")]),t._v(" "),e("th",[t._v("Java API")]),t._v(" "),e("th",{staticStyle:{"text-align":"left"}},[t._v("Python API")]),t._v(" "),e("th",[e("div",{staticStyle:{width:"200pt"}},[t._v("API Comparison")])])])]),t._v(" "),e("tbody",[e("tr",[e("td",[t._v("1")]),t._v(" "),e("td",[t._v("Initialize session")]),t._v(" "),e("td",[e("code",[t._v("Session.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).enableCacheLeader(boolean enableCacheLeader).version(Version version).build();")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v('Session(ip, port_, username_, password_,fetch_size=1024, zone_id="UTC+8")')])]),t._v(" "),e("td",[t._v("1. The python native API lacks the default configuration to initialize the session"),e("br"),t._v("2. The python native API is missing the initialization session of specifying multiple connectable nodes"),e("br"),t._v("3. The python native API is missing. Use other configuration items to initialize the session")])]),t._v(" "),e("tr",[e("td",[t._v("2")]),t._v(" "),e("td",[t._v("Open session")]),t._v(" "),e("td",[e("code",[t._v("void open() void open(boolean enableRPCCompression)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.open(enable_rpc_compression=False)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("3")]),t._v(" "),e("td",[t._v("Close session")]),t._v(" "),e("td",[e("code",[t._v("void close()")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.close()")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("4")]),t._v(" "),e("td",[t._v("Set storage group")]),t._v(" "),e("td",[e("code",[t._v("void setStorageGroup(String storageGroupId)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.set_storage_group(group_name)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("5")]),t._v(" "),e("td",[t._v("Delete storage group")]),t._v(" "),e("td",[e("code",[t._v("void deleteStorageGroup(String storageGroup) void deleteStorageGroups(List<String> storageGroups)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.delete_storage_group(group_name) session.delete_storage_groups(group_name_lst)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("6")]),t._v(" "),e("td",[t._v("Create timeseries")]),t._v(" "),e("td",[e("code",[t._v("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)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("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)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("7")]),t._v(" "),e("td",[t._v("Create aligned timeseries")]),t._v(" "),e("td",[e("code",[t._v("void createAlignedTimeseries(String prefixPath, List<String> measurements,List<TSDataType> dataTypes, List<TSEncoding> encodings,CompressionType compressor, List<String> measurementAliasList);")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.create_aligned_time_series(device_id, measurements_lst, data_type_lst, encoding_lst, compressor_lst)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("8")]),t._v(" "),e("td",[t._v("Delete timeseries")]),t._v(" "),e("td",[e("code",[t._v("void deleteTimeseries(String path) void deleteTimeseries(List<String> paths)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.delete_time_series(paths_list)")])]),t._v(" "),e("td",[t._v("Python native API is missing an API to delete a time series")])]),t._v(" "),e("tr",[e("td",[t._v("9")]),t._v(" "),e("td",[t._v("Detect whether the timeseries exists")]),t._v(" "),e("td",[e("code",[t._v("boolean checkTimeseriesExists(String path)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.check_time_series_exists(path)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("10")]),t._v(" "),e("td",[t._v("Metadata template")]),t._v(" "),e("td",[e("code",[t._v("public void createSchemaTemplate(Template template);")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}}),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("11")]),t._v(" "),e("td",[t._v("Insert tablet")]),t._v(" "),e("td",[e("code",[t._v("void insertTablet(Tablet tablet) void insertTablets(Map<String, Tablet> tablets)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.insert_tablet(tablet_) session.insert_tablets(tablet_lst)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("12")]),t._v(" "),e("td",[t._v("Insert record")]),t._v(" "),e("td",[e("code",[t._v("void 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)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("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)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("13")]),t._v(" "),e("td",[t._v("Write with type inference")]),t._v(" "),e("td",[e("code",[t._v("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)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.insert_str_record(device_id, timestamp, measurements, string_values)")])]),t._v(" "),e("td",[t._v("1. The python native API lacks an API for inserting multiple records"),e("br"),t._v("2. The python native API lacks the ability to insert multiple records belonging to the same device")])]),t._v(" "),e("tr",[e("td",[t._v("14")]),t._v(" "),e("td",[t._v("Write of aligned time series")]),t._v(" "),e("td",[e("code",[t._v("insertAlignedRecord insertAlignedRecords insertAlignedRecordsOfOneDevice insertAlignedStringRecordsOfOneDevice insertAlignedTablet insertAlignedTablets")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("insert_aligned_record insert_aligned_records insert_aligned_records_of_one_device insert_aligned_tablet insert_aligned_tablets")])]),t._v(" "),e("td",[t._v("Python native API is missing the writing of aligned time series with judgment type")])]),t._v(" "),e("tr",[e("td",[t._v("15")]),t._v(" "),e("td",[t._v("Data deletion")]),t._v(" "),e("td",[e("code",[t._v("void deleteData(String path, long endTime) void deleteData(List<String> paths, long endTime)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}}),t._v(" "),e("td",[t._v("1. The python native API lacks an API to delete a piece of data"),e("br"),t._v("2. The python native API lacks an API to delete multiple pieces of data")])]),t._v(" "),e("tr",[e("td",[t._v("16")]),t._v(" "),e("td",[t._v("Data query")]),t._v(" "),e("td",[e("code",[t._v("SessionDataSet executeRawDataQuery(List<String> paths, long startTime, long endTime) SessionDataSet executeLastDataQuery(List<String> paths, long LastTime)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}}),t._v(" "),e("td",[t._v("1. The python native API lacks an API for querying the original data"),e("br"),t._v("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")])]),t._v(" "),e("tr",[e("td",[t._v("17")]),t._v(" "),e("td",[t._v("Iotdb SQL API - query statement")]),t._v(" "),e("td",[e("code",[t._v("SessionDataSet executeQueryStatement(String sql)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.execute_query_statement(sql)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("18")]),t._v(" "),e("td",[t._v("Iotdb SQL API - non query statement")]),t._v(" "),e("td",[e("code",[t._v("void executeNonQueryStatement(String sql)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[e("code",[t._v("session.execute_non_query_statement(sql)")])]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[t._v("19")]),t._v(" "),e("td",[t._v("Test API")]),t._v(" "),e("td",[e("code",[t._v("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)")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}},[t._v("Python client support for testing is based on the testcontainers library")]),t._v(" "),e("td",[t._v("Python API has no native test API")])]),t._v(" "),e("tr",[e("td",[t._v("20")]),t._v(" "),e("td",[t._v("Connection pool for native interfaces")]),t._v(" "),e("td",[e("code",[t._v("SessionPool")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}}),t._v(" "),e("td",[t._v("Python API has no connection pool for native API")])]),t._v(" "),e("tr",[e("td",[t._v("21")]),t._v(" "),e("td",[t._v("API related to cluster information")]),t._v(" "),e("td",[e("code",[t._v("iotdb-thrift-cluster")])]),t._v(" "),e("td",{staticStyle:{"text-align":"left"}}),t._v(" "),e("td",[t._v("Python API does not support interfaces related to cluster information")])])])])])}),[],!1,null,null,null);e.default=n.exports}}]);