Data Export Method, Device, Electronic Device and Storage Medium
By creating connection objects and building connection pools to optimize the data export process, the problem of low data export efficiency in the existing technology is solved, and more efficient data reading and writing speed is achieved.
Patent Information
- Application Number
- CN202210662023.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-06-13
AI Technical Summary
The prior art has the problem of slow data reading and writing speed during the data export process, resulting in low data export efficiency.
By creating a connection object and building a connection pool, after querying the target tag information, the query result is saved in the corresponding connection object, and the target data is exported from the first storage space to the second storage space using the connection object in the connection pool.
Improves the data export efficiency and improves the data reading and writing speed.
Smart Images

Figure CN115062015B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular, to a data export method, device, electronic device, and storage medium. Background Art
[0002] In recent years, the informatization level of power enterprises in China has been gradually improved. Using the Supervisory Information System (SIS) to complete the integration of enterprise management and control and real-time information sharing has become a new direction for power enterprises to improve overall efficiency and seek innovative development. The first step in the operation of the real-time monitoring system is to collect the original data in the power plant, that is, time series data, and perform preprocessing on it. According to the processing results, the operation status of the power plant can be modeled, predicted, and controlled. In the existing technical solutions for data communication with the SIS system, most of them are indirect communications through the OPC protocol. The disadvantage is that in the case of relatively independent different units in thermal power plants, only the data of the corresponding unit can be accessed, resulting in low data reading and writing efficiency. Many data sources of the SIS system are real-time data measured by sensors or flow meters, and there are often thousands of such sensors. Therefore, the time series data generated by the SIS system per second is huge. And subsequent advanced applications such as time series modeling and prediction based on historical data sets rely heavily on complete data sets. Two problems faced in traditional solutions are: one is that when the sampling time is too long, exporting the data set will face insufficient memory; the other is that storing all complete historical data will consume a lot of disk space. Summary of the Invention
[0003] An embodiment of the present invention provides a data export method, aiming to solve the problem that in the existing data export process, the data reading and writing speed is slow, resulting in low data export efficiency. By creating a connection object and constructing a connection pool containing multiple connection objects, after querying all tag information, the query results are saved in the corresponding connection objects, and the target data is exported from the first storage space to the second storage space through the connection objects in the connection pool, improving the data export efficiency.
[0004] In a first aspect, an embodiment of the present invention provides a data export method, including the following steps:
[0005] Create a connection object according to connection parameters to obtain a connection pool containing multiple said connection objects;
[0006] Query all tag information, and save the query results of all said tag information in the corresponding said connection objects;
[0007] Export the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object.
[0008] Optionally, before the step of creating a connection object according to the connection parameters to obtain a connection pool containing a plurality of the connection objects, the method further includes:
[0009] Perform variable declaration and variable initialization, where the variables include tag information and instance information.
[0010] Optionally, after the step of exporting the data corresponding to the target tag information from the first storage space to the second storage space through the connection object, the method further includes:
[0011] Close the thread handle to disconnect the connection of each connection object in the connection pool and release the memory.
[0012] Optionally, the step of exporting the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object includes:
[0013] Read the target data corresponding to the target tag information from the first storage space through the connection object;
[0014] Store the target data with the international time as the primary key into the second storage space.
[0015] Optionally, after the step of storing the target data with the international time as the primary key into the second storage space, the method further includes:
[0016] Insert a corresponding timestamp column for the primary key in the second storage space.
[0017] Optionally, the step of storing the target data with the international time as the primary key into the second storage space includes:
[0018] Calculate the data change amount between the current moment and the previous moment;
[0019] When the data change amount meets the preset threshold accuracy, determine the data at the current moment as the target data;
[0020] Store the target data with the international time as the primary key into the second storage space.
[0021] Optionally, after storing the target data with the international time as the primary key into the second storage space, the method further includes:
[0022] Obtain the export conditions of the user;
[0023] According to the export conditions, a query strategy is calculated through the timestamp column;
[0024] According to the query strategy, the data required by the user is exported.
[0025] In a second aspect, an embodiment of the present invention provides a data export device, which includes:
[0026] A creation module, configured to create a connection object according to connection parameters, and obtain a connection pool including a plurality of the connection objects;
[0027] A query module, configured to query all tag information, and save the query result of all the tag information in the corresponding connection object;
[0028] A first export module, configured to export the target data corresponding to the target tag information from a first storage space to a second storage space through the connection object.
[0029] In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps in the data export method provided by the embodiment of the present invention are implemented.
[0030] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the data export method provided by the embodiment of the invention are implemented.
[0031] In the embodiment of the present invention, a connection object is created according to connection parameters, and a connection pool including a plurality of the connection objects is obtained; all tag information is queried, and the query result of all the tag information is saved in the corresponding connection object; the target data corresponding to the target tag information is exported from a first storage space to a second storage space through the connection object. By creating a connection object and constructing a connection pool including a plurality of connection objects, after querying the target tag information, the query result is saved in the corresponding connection object, and the target data is exported from the first storage space to the second storage space through the connection object in the connection pool, improving the data export efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0033] Figure 1It is a flowchart of a data export method provided by an embodiment of the present invention;
[0034] Figure 2 It is a flowchart of another data export method provided by an embodiment of the present invention;
[0035] Figure 3 It is a flowchart of another data export method provided by an embodiment of the present invention;
[0036] Figure 4 It is a structural diagram of a data export device provided by an embodiment of the present invention;
[0037] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0038] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0039] A data export system provided by an embodiment of the present invention includes: a first storage space and a second storage space. Among them, the first storage space is used to store measurement data, and the measurement data can be data during the measurement process, and the measurement data can be obtained by measuring through a sensor or a flowmeter.
[0040] In the embodiment of the present invention, the above data export system can be used for the informatization of power enterprises, and specifically can be applied to a power real-time monitoring system. The above measurement data is the original data collected by power production units, and can also be called time series data. The above measurement data can be used for modeling prediction and control of the operation conditions of power production units. The above time series data includes real-time data and historical data, and the real-time data and historical data arranged in time sequence constitute the above time series data.
[0041] The above first storage space can be a database of a data acquisition system, specifically a database of an SIS system, and the above second storage space can be a time series database, specifically an influxDB database.
[0042] An application program for the data export system can be developed based on a c++ development environment, and the application program can set corresponding data export instances according to the query rules of the first storage space.
[0043] Specifically, please refer to Figure 1 , Figure 1The following is a flowchart of a data export method provided by an embodiment of the present invention. As Figure 1 shown, the settings of the application program may include the following steps:
[0044] 101. Variable declaration and initialization of the memory allocation space.
[0045] In the embodiment of the present invention, variable declaration mainly declares variables such as tag names, database instance names, database tag names, and proxy server quality codes, which are used to indicate the types and names of variables to the program, so as to allocate corresponding memory spaces and initial values for these variables, facilitating query. Initializing the variables initializes the corresponding memory allocation space.
[0046] 102. Create multiple connection objects to form a connection pool.
[0047] In the embodiment of the present invention, a connection object (Connection object) is responsible for connecting to the data source. The connection object can also be called a database command object. Its main function is to perform operations on data such as addition, deletion, modification, and query, and can also be used to perform read and write processes. Multiple connection objects form a corresponding connection pool, and the corresponding connection object can be found in the connection pool to perform corresponding read and write operations.
[0048] 103. Query all tag names.
[0049] In the embodiment of the present invention, all tag names in the first storage space can be queried to obtain a query result corresponding to the tag name. In the first storage space, each tag name corresponds to a real-time data or historical data.
[0050] The query result can be saved in the connection object, so that the connection object has the function of tag query, and thus the connection object can read and write corresponding data according to the corresponding tag name.
[0051] 104. Perform data read and write according to the obtained tag name.
[0052] In the embodiment of the present invention, data read and write are performed in the first storage space through the connection object. Further, the target data corresponding to each tag name can be exported from the first storage space through the connection object. The target data corresponding to each tag name can be exported from the first storage space through multiple connection objects simultaneously, thereby improving the efficiency of data export.
[0053] 105. Disconnect the connection object.
[0054] In the embodiment of the present invention, when the data export is completed, the connection between the connection object and the first storage space is disconnected, and data read and write are stopped, thereby stopping data export.
[0055] 106. Release memory resources.
[0056] In the embodiment of the present invention, since the data in the first storage space is loaded in the memory, after disconnecting the connection object from the first storage space, the memory resources are released, the memory consumption is saved, and the next memory loading is facilitated.
[0057] In the embodiment of the present invention, the application program can directly communicate with the SIS system, and there are complete interfaces for reading and writing real-time data and historical data. At the same time, multi-threaded data reading and writing can be achieved through multiple connection objects, thereby improving the data reading and writing efficiency.
[0058] Specifically, the above-mentioned first storage space is the database of the SIS system, the second storage space is the time series database, and the target data is real-time data. Please refer to Figure 2 , Figure 2 is the flowchart of another data export method provided by the embodiment of the present invention. As Figure 2 shown, the settings of the application program may further include the following steps:
[0059] 201. Sparsely store the real-time data read from the SIS system into the time series database with the international time as the primary key.
[0060] In the embodiment of the present invention, the corresponding real-time data can be read from the database of the SIS system through the above-mentioned connection object, and the real-time data is stored in the time series database in a sparse storage manner with the international time as the primary key. The time series database can store the corresponding data in time series and add corresponding time series components to control and query the data. Specifically, the time series database can be an influxDB database.
[0061] 202. Insert a corresponding timestamp column into the database table.
[0062] In the embodiment of the present invention, the above-mentioned database table is the database table in the time series database. A corresponding timestamp column is inserted into the database table so that the target data can be controlled or queried by the timestamp column.
[0063] A timestamp, usually a character sequence, uniquely identifies a certain moment in time and can prevent the time of the target data from being forged and tampered with.
[0064] 203. When the user exports the data set, it is required to upload the list of point names to be exported, the start time of the export, and the sampling interval of the data set.
[0065] In an embodiment of the present invention, when a user wants to export a data set from a second storage space, they can be required to upload a list of point names to be exported, the start time of the export, and the sampling interval of the data set. The above list of point names can include tag names, and the tag names can be used to query data in the second storage space as point name objects. The start time of the export can be, for example, January 1, 2022, and the sampling interval can be, for example, sampling once every 5 seconds.
[0066] The user can input the corresponding list of point names, the start time of the export, and the sampling interval of the data set through the front-end interface of the second storage space. By uploading the list of point names to be exported, the start time of the export, and the sampling interval of the data set, the query range can be narrowed, the query speed can be increased, the data read and write speed can be increased, and the export speed of the data set can be increased.
[0067] 204. Query in the database according to the requirements of the user in the previous step.
[0068] In an embodiment of the present invention, the requirements of the above user are the above list of point names, the start time of the export, and the sampling interval of the data set. In this way, the data set required by the user can be accurately exported.
[0069] 205. Dump the queried data into the parquet file format.
[0070] In an embodiment of the present invention, Parquet is a columnar storage format for analytical services. Dumping the queried data into the parquet file format can make the data more intuitive in terms of time series and is also convenient for subsequent data processing.
[0071] In an embodiment of the present invention, by sparsely storing the proposed massive time series data and periodically exporting the data set at fixed points and times, while meeting the flexible needs of users, the memory occupied during query can be minimized as much as possible, the query speed can be increased, and the sparse storage of data also saves disk space.
[0072] Please continue to refer to Figure 3 , Figure 3 which is a flowchart of another data export method provided by an embodiment of the present invention. As Figure 3 shown, the method includes the following steps:
[0073] 301. Create a connection object according to the connection parameters to obtain a connection pool containing multiple connection objects.
[0074] In an embodiment of the present invention, the above connection parameters can include the server IP, login account, and password. Different connection objects are created according to different connection parameters, so as to obtain multiple connection objects, and a connection pool is constructed based on the multiple connection objects.
[0075] 302. Query all tag information and save the query results of all tag information in the corresponding connection object.
[0076] In the embodiments of the present invention, all tag information may be all tag information predefined in the first storage space. In the first storage space, each tag corresponds to real-time data or historical data of a collection unit.
[0077] Saving the query results corresponding to all tag information in the corresponding connection object enables direct access to the corresponding query results through the connection object. Therefore, the embodiments of the present invention can directly communicate with the SIS system through the connection object, improving data read and write efficiency.
[0078] 303. Export the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object.
[0079] In the embodiments of the present invention, the above-mentioned target tag information may be tag information uploaded by the user. The user can input the corresponding tag information through the front-end interface as the target tag information. After obtaining the target tag information uploaded by the user, according to the target tag information, find the corresponding connection object in the connection pool, and through the connection object corresponding to the target tag information, export the target data corresponding to the target tag information from the first storage space and import the target data into the second storage space.
[0080] The above-mentioned first storage space may be the database of the data acquisition system, specifically the database of the SIS system. The above-mentioned second storage space may be a time series database, specifically the influxDB database.
[0081] Optionally, before the step of creating a connection object according to the connection parameters to obtain a connection pool containing multiple said connection objects, variable declarations and variable initializations may also be performed. The variables include tag information and instance information.
[0082] In the embodiments of the present invention, variable declarations mainly declare variables such as tag names, database instance names, database tag names, and proxy server quality codes, which are used to indicate the types and names of variables to the program, so as to allocate corresponding memory spaces and initial values for these variables, facilitating query. Initializing the variables initializes the memory allocation space corresponding to the variables with initial values.
[0083] Optionally, after the step of exporting the data corresponding to the target tag information from the first storage space to the second storage space through the connection object, the thread handle may also be closed to disconnect the connections of each connection object in the connection pool and release the memory.
[0084] In an embodiment of the present invention, when the data export is completed, the connection between the connection object and the first storage space can be disconnected, and the data reading and writing can be stopped, thereby stopping the data export. Specifically, the thread handle can be closed to disconnect the connection of each connection object in the connection pool and release the memory. In this way, after disconnecting the connection between the connection object and the first storage space, the memory resources are released, the memory consumption is saved, and it is convenient for the next memory loading.
[0085] Optionally, in the step of exporting the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object, the target data corresponding to the target tag information can be read from the first storage space through the connection object; the target data is stored in the second storage space with the international time as the primary key.
[0086] In an embodiment of the present invention, the above target data can be real-time data or historical data. Both real-time data and historical data have corresponding collection times. The collection time is converted into international time and stored in the second storage space with the international time as the primary key. The above primary key is the main query tag. When querying in the second storage space, the corresponding value can be found first through the primary key. For example, all data with the international time of 01:01:01 on January 1, 2022 can be found.
[0087] After reading the target data corresponding to the target tag information from the first storage space through the connection object and storing the target data in the second storage space with the international time as the primary key, the time metric can be unified as the international time. After setting the international time as the primary key, the corresponding value (data) can be quickly queried through the primary key.
[0088] Optionally, after the step of storing the target data in the second storage space with the international time as the primary key, a corresponding timestamp column can also be inserted into the primary key in the second storage space.
[0089] In an embodiment of the present invention, the second storage space is a time series database. The time series database can provide the function of storing data in time series and add corresponding time series control and query components. The above time series database includes database tables. The database tables are used to store the corresponding target data. The database tables include a primary key and a value. Among them, the primary key is a primary key based on international time, and the value is the corresponding target data. A corresponding timestamp column is inserted into the database table so that the target data can be controlled or queried by the timestamp column.
[0090] Specifically, according to the added time series control and query components including a timestamp column, a corresponding timestamp column can be inserted into the primary key of the international time to prevent the time of the target data from being forged and tampered with, thereby improving the data security of the second storage space. At the same time, the query of the data in the second storage space can also be controlled through the timestamp column.
[0091] Optionally, in the step of storing the target data with the international time as the primary key into the second storage space, the data change amount between the current moment and the previous moment can be calculated; when the data change amount meets the preset threshold accuracy, the data at the current moment is determined as the target data; and the target data is stored into the second storage space with the international time as the primary key.
[0092] In the embodiment of the present invention, the target data at the current moment can be subtracted from the target data at the previous moment to obtain the data change amount between the current moment and the previous moment. When the data change amount is less than the threshold, it indicates that the data change amount between the data at the current moment and the data at the previous moment is very small, and there is no need to store the target data at the current moment. When the data change amount is greater than the threshold, it indicates that the data change amount between the data at the current moment and the data at the previous moment is very large, and it is necessary to store the target data at the current moment.
[0093] Specifically, the real-time data read from the SIS system is sparsely stored in the time series database with the international time as the primary key. To solve the problem that the complete storage of data consumes disk space, it is possible to determine whether to store the data of this second into the database by setting the threshold accuracy of the data change compared with the previous second, so as to achieve the sparse storage of data and save disk space.
[0094] Optionally, after storing the target data with the international time as the primary key into the second storage space, the export condition of the user can also be obtained; according to the export condition, the query strategy is calculated through the timestamp column; and according to the query strategy, the data required by the user is exported.
[0095] In the embodiment of the present invention, the above export condition may include the exported point name list, the exported start time, and the sampling interval of the data set. When the user wants to export the data set from the second storage space, it can be required to upload the exported point name list, the exported start time, and the sampling interval of the data set. The above point name list may include the tag name, and this tag name can be used as the point name object to query data in the second storage space. The exported start time may be, for example, January 1, 2022, and the sampling interval may be, for example, sampling once every 5 seconds.
[0096] The user can input the exported point name list, the exported start time, and the sampling interval of the data set through the front-end interface of the second storage space. By uploading the exported point name list, the exported start time, and the sampling interval of the data set, the query range can be narrowed, the query speed can be improved, the data read and write speed can be improved, and the data set export speed can be improved.
[0097] Specifically, based on the inserted timestamp column, the interval data can be obtained by the method of integer division and taking the remainder, so as to minimize the memory occupied during query as much as possible while meeting the flexible needs of the user and improve the query speed.
[0098] Further, determine the user's needs according to the export conditions, query in the second storage space according to the user's needs, and convert the query result into a dataframe form in memory to facilitate aligning and filling missing values and preliminary data preprocessing; dump the queried data into a parquet file format. Parquet is a new type of columnar storage format, which facilitates direct columnar query during subsequent use and reduces the memory used.
[0099] In an embodiment of the present invention, according to connection parameters, a connection object is created to obtain a connection pool containing a plurality of the connection objects; target label information is queried, and the query result of the target label information is saved in the corresponding connection object; the target data corresponding to the target label information is exported from the first storage space to the second storage space through the connection object. By creating a connection object and constructing a connection pool containing a plurality of connection objects, after querying the target label information, the query result is saved in the corresponding connection object, and the connection object in the connection pool is used to export the target data from the first storage space to the second storage space, improving the data export efficiency.
[0100] It should be noted that the data export method provided by the embodiment of the present invention can be applied to devices such as smart phones, computers, and servers.
[0101] Optionally, please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a data export device provided by an embodiment of the present invention. As Figure 4 shown, the device includes:
[0102] A creation module 401, configured to create a connection object according to connection parameters to obtain a connection pool containing a plurality of the connection objects;
[0103] A query module 402, configured to query all label information and save the query result of the all label information in the corresponding connection object;
[0104] A first export module 403, configured to export the target data corresponding to the target label information from the first storage space to the second storage space through the connection object.
[0105] Optionally, the device further includes:
[0106] An initialization module, configured to perform variable declaration and variable initialization, where the variables include label information and instance information.
[0107] Optionally, the device further includes:
[0108] A disconnection module, configured to close a thread handle to disconnect each connection object in the connection pool and release memory.
[0109] Optionally, the first export module 403 includes:
[0110] A reading unit, configured to read target data corresponding to the target tag information from a first storage space through the connection object;
[0111] A first storage unit, configured to store the target data in a second storage space with international time as the primary key.
[0112] Optionally, the apparatus further includes:
[0113] An insertion module, configured to insert a corresponding timestamp column for the primary key in the second storage space.
[0114] Optionally, the insertion module includes:
[0115] A calculation unit, configured to calculate a data change amount between the current moment and the previous moment;
[0116] A determination unit, configured to determine the data at the current moment as target data when the data change amount meets a preset threshold accuracy;
[0117] A second storage unit, configured to store the target data in a second storage space with international time as the primary key.
[0118] Optionally, the apparatus further includes:
[0119] An acquisition module, configured to acquire an export condition of a user;
[0120] A calculation module, configured to calculate a query strategy through the timestamp column according to the export condition;
[0121] A second export module, configured to export data required by the user according to the query strategy.
[0122] It should be noted that the data export apparatus provided in the embodiments of the present invention can be applied to devices such as smartphones, computers, and servers that can perform business analysis at the layer level.
[0123] The data export apparatus provided in the embodiments of the present invention can implement each process implemented by the data export method in the above method embodiments and can achieve the same beneficial effects. To avoid repetition, details are not described herein again.
[0124] See Figure 5 , Figure 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present invention. As Figure 5As shown, it includes: a memory 502, a processor 501, and a computer program of a data export method stored on the memory 502 and executable on the processor 501, where:
[0125] The processor 501 is configured to call the computer program stored in the memory 502 and execute the following steps:
[0126] Create a connection object according to the connection parameters to obtain a connection pool containing multiple such connection objects;
[0127] Query all tag information and save the query results of all the tag information in the corresponding connection object;
[0128] Export the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object.
[0129] Optionally, before the step of creating a connection object according to the connection parameters to obtain a connection pool containing multiple such connection objects, the method executed by the processor 501 further includes:
[0130] Perform variable declaration and variable initialization, where the variables include tag information and instance information.
[0131] Optionally, after the step of exporting the data corresponding to the target tag information from the first storage space to the second storage space through the connection object, the method executed by the processor 501 further includes:
[0132] Close the thread handle to disconnect the connections of each connection object in the connection pool and release the memory.
[0133] Optionally, the step of exporting the target data corresponding to the target tag information from the first storage space to the second storage space executed by the processor 501 includes:
[0134] Read the target data corresponding to the target tag information from the first storage space through the connection object;
[0135] Store the target data with the international time as the primary key into the second storage space.
[0136] Optionally, after the step of storing the target data with the international time as the primary key into the second storage space, the method executed by the processor 501 further includes:
[0137] Insert a corresponding timestamp column for the primary key in the second storage space.
[0138] Optionally, the step of storing the target data in the second storage space with the international time as the primary key, which is executed by the processor 501, includes:
[0139] Calculating the data change amount between the current moment and the previous moment;
[0140] When the data change amount meets the preset threshold accuracy, determining the data at the current moment as the target data;
[0141] Storing the target data in the second storage space with the international time as the primary key.
[0142] Optionally, after storing the target data in the second storage space with the international time as the primary key, the method further includes the following steps executed by the processor 501:
[0143] Obtaining the export condition of the user;
[0144] Calculating a query strategy through the timestamp column according to the export condition;
[0145] Exporting the data required by the user according to the query strategy.
[0146] It should be noted that the electronic device provided in the embodiments of the present invention can be applied to devices such as smartphones, computers, and servers that can perform data export.
[0147] The electronic device provided in the embodiments of the present invention can implement each process realized by the data export method in the above method embodiments, and can achieve the same beneficial effects. To avoid repetition, it will not be elaborated here.
[0148] The embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it realizes each process of the data export method or the application-side data export method provided in the embodiments of the present invention, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0149] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0150] The above-disclosed is only the preferred embodiment of the present invention. Of course, the scope of rights of the present invention cannot be limited thereby. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.
Claims
1. A data export method, characterized in that, It includes the following steps: Perform variable declarations and variable initializations, where the variables include tag information and instance information; According to the connection parameters, create connection objects for performing data addition, deletion, modification, query, reading, and writing processes, and obtain a connection pool containing multiple such connection objects; Query all tag information and save the query results of all the tag information in the corresponding connection objects; Export the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object, including: Read the target data corresponding to the target tag information from the first storage space through the connection object; Store the target data with international time as the primary key in the second storage space; In the second storage space, insert a corresponding timestamp column for the primary key; Obtain the export conditions of the user; According to the export conditions, calculate a query strategy through the timestamp column; According to the query strategy, export the data required by the user.
2. The method according to claim 1, characterized in that, After the step of exporting the data corresponding to the target tag information from the first storage space to the second storage space through the connection object, the method further includes: Close the thread handle to disconnect the connections of each connection object in the connection pool and release the memory.
3. The method according to claim 2, wherein The step of storing the target data with international time as the primary key in the second storage space includes: Calculate the data change amount between the current moment and the previous moment; When the data change amount meets the preset threshold accuracy, determine the data at the current moment as the target data; Store the target data with international time as the primary key in the second storage space.
4. A data export device, characterized in that, The device includes: A creation module for performing variable declarations and variable initializations, where the variables include tag information and instance information, and according to the connection parameters, creating connection objects for performing data addition, deletion, modification, query, reading, and writing processes, and obtaining a connection pool containing multiple such connection objects; A query module for querying all tag information and saving the query results of all the tag information in the corresponding connection objects; A first export module for exporting the target data corresponding to the target tag information from the first storage space to the second storage space through the connection object, including: Reading the target data corresponding to the target tag information from the first storage space through the connection object; Storing the target data with international time as the primary key in the second storage space; In the second storage space, inserting a corresponding timestamp column for the primary key; Obtaining the export conditions of the user; According to the export conditions, calculating a query strategy through the timestamp column; According to the query strategy, exporting the data required by the user.
5. An electronic device, characterized in that, It includes: A memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, it implements the steps in the data export method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, it implements the steps in the data export method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Method for storing IOT time series data related to geographical location information
CN104008212A
Method and system for connecting dynamic management database
CN104915412A