Multi-database management method, server and computer readable storage medium
By providing a unified interface to manage multiple databases through the data platform, the problem of different database interfaces and operation methods is solved, and efficient data management and scalability of business systems are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-10-30
- Publication Date
- 2026-05-01
AI Technical Summary
Different databases have different interfaces and operation methods, which means that business systems need to consider the characteristics of each database when managing multiple databases, increasing the difficulty and complexity of management.
By operating on the database through a unified interface provided by the data platform, business systems do not directly interact with various databases, but manage them through the data platform's interface, thus decoupling business logic from database operation logic.
It reduces the complexity of managing multiple databases in business systems, improves the convenience and scalability of data management, and reduces the difficulty of development and maintenance.
Smart Images

Figure CN121957728A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal and communication technology, and in particular to multi-database management methods, servers, and computer-readable storage media. Background Technology
[0002] Currently, the business logic of many electronic devices is processed on cloud servers. Cloud servers can run business systems and one or more databases for storing business data. Business systems can process business data based on pre-defined business logic to implement one or more business functions.
[0003] As the types of electronic devices increase and the diversity and complexity of business functions continue to grow, the types of databases that business systems need to operate on also increase. However, different databases have different interfaces and operation methods, which means that business systems need to consider the characteristics of each database when operating on it, increasing the difficulty of managing business data. Summary of the Invention
[0004] This application provides a multi-database management method, a server, and a computer-readable storage medium. The method is applied to a server, where the business system does not directly interface with various databases but instead calls interfaces provided by a data platform to operate on the databases. Each interface can be used to operate on different databases. This eliminates the need for the business system to consider differences in interfaces and operation methods between different databases during maintenance and development, thereby reducing the complexity of managing data across multiple databases.
[0005] In a first aspect, embodiments of this application provide a multi-database management method. This method is applied to a server in a first communication system. The first communication system includes a server, multiple business objects, and multiple databases. The server has one or more business functions, and the databases are used to manage data from the multiple business objects. The method includes: detecting the activation of a first business function, the first business function including program code that calls a first interface, the first interface encapsulating functions for performing a first operation on multiple databases, and the one or more business functions including the first business function; calling the first interface through the first business function and passing an identifier of a first database to the first interface, the multiple databases including the first database; selecting a first function from the functions for performing a first operation on multiple databases encapsulated in the first interface based on the identifier of the first database, the first function being the function for performing a first operation on the first database; and running the first function.
[0006] In other words, the first business function can call the first interface, which is used to perform a first operation on multiple databases. The server can call the first interface to perform operations on the first database among multiple databases. The first interface selects the function to perform the first operation on the first database from among the functions that perform the first operation on multiple databases. This means that when operating on the databases, there is no need to consider the differences in interfaces and operation methods between databases; only the interface needs to be called, and the functions provided by the interface will specifically implement the operations on different databases. This improves the convenience of managing multiple databases, decouples the business logic of the business function from the specific database operation logic, thereby reducing the complexity of maintaining the server and improving the scalability of the database.
[0007] In conjunction with the first aspect, in some embodiments, the first interface encapsulates the function of writing data to multiple databases respectively. Before calling the first interface through the first business function and passing the identifier of the first database to the first interface, the method further includes: receiving the first data of the first business object, wherein the multiple business objects include the first business object.
[0008] In conjunction with the first aspect, in some embodiments, when passing the identifier of the first database to the first interface, the method further includes: passing first data to the first interface; and running a first function, including: writing the first data to the first database.
[0009] In other words, the first interface can be an interface for writing data to multiple databases. The first business function can call the first interface and pass in the identifier of the first database, indicating that it needs to store the first data in the first database among multiple databases. Then, the first interface can select the corresponding plugin for the first database to process the first database and thus achieve the aforementioned first function. In this way, when the business function writes data to the database, it only needs to call the interface, reducing the complexity of the business function when operating data.
[0010] In conjunction with the first aspect, in some embodiments, if the first data table does not exist in the first database, the first function further includes creating the first data table for the first database before running the first function, the first data table being used to store the first data.
[0011] In other words, when writing data, if the data table does not exist, the first interface will create the data table for the business object and then store the data in the data table. This way, the business object or business system does not need to worry about whether the underlying database table exists; they only need to focus on data read and write operations, making the interface provided to the business object simpler and faster. Optionally, if the creation of the first data table fails, the failed first data table can be deleted and recreated.
[0012] In conjunction with the first aspect, in some embodiments, the first interface encapsulates the function of reading data from multiple databases respectively. When the identifier of the first database is passed to the first interface, the method further includes: passing the first position of the second data in the first database to the first interface; and running the first function, including: reading the second data from the first database based on the first position.
[0013] In other words, business functions only need to call the interface to read data, reducing the difficulty of reading data.
[0014] In conjunction with the first aspect, in some embodiments, after reading the second data from the first database based on the first location, the method further includes: sending the second data to a second business object, wherein the plurality of business objects includes the second business object.
[0015] In other words, after reading the second data, the server can also return business data to the business object. This second business object can be the business object that requested to read the second data from the server. In this way, the business object can read data from different databases through the server.
[0016] In conjunction with the first aspect, in some embodiments, the first interface encapsulates the function of deleting data from multiple databases respectively. When the identifier of the first database is passed to the first interface, the method further includes: passing the second position of the third data in the first database to the first interface; and running the first function, including: deleting the third data from the first database based on the second position.
[0017] In other words, this way, business functions only need to call the interface to perform data deletion operations on different databases, reducing the difficulty of deleting data.
[0018] In conjunction with the first aspect, in some embodiments, the first interface encapsulates the function of performing statistical analysis on data from multiple databases respectively. When the identifier of the first database is passed to the first interface, the method further includes: passing the third position of the fourth data in the first database and the identifier of the first statistics to the first interface; running the first function, including: reading the fourth data based on the third position; and performing the first statistics on the fourth data based on the identifier of the first statistics.
[0019] Among them, business functions can perform statistical analysis on data by calling interfaces. In this way, business functions can perform statistical functions on data from different databases through interfaces, reducing the complexity of business functions when performing statistical analysis on data.
[0020] In conjunction with the first aspect, in some embodiments, when calling the first interface through the first business function and passing the identifier of the first database to the first interface, the method further includes: passing the first parameter to the first interface; determining the second parameter corresponding to the first parameter from the first mapping table according to the identifier of the first database, wherein the first mapping table stores the original parameters corresponding to multiple input parameters of the first database, the original parameters including the first parameter, and the original parameters are generated by the business object.
[0021] In other words, the server can also contain a mapping table. This way, when the original parameter generated by the business object is inconsistent with the underlying parameter (the second parameter), the mapping table can be consulted to determine the second parameter corresponding to the first parameter. Thus, business functions only need to use their own generated original parameters to operate on business data, without needing to worry about how these original parameters are stored in different databases, further reducing the difficulty of managing data across multiple databases.
[0022] In conjunction with the first aspect, in some embodiments, the multiple business objects include one or more smart home devices, and / or one or more mobile phones.
[0023] In a second aspect, embodiments of this application provide an electronic device, which includes a memory and a processor coupled to the memory; the memory stores a computer program, and when the processor executes the computer program, the electronic device implements the method described in any one of the first aspects.
[0024] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program or computer instructions, which are executed by a processor to implement the method described in any of the first aspects above.
[0025] Fourthly, embodiments of this application provide a computer program product, which, when executed by a processor, implements the method described in any of the first aspects above.
[0026] Fifthly, embodiments of this application provide a chip including a processor and a memory, wherein the memory is used to store computer programs or computer instructions, and the processor is used to execute the computer programs or computer instructions stored in the memory, causing the chip to perform the method described in any of the first aspects above.
[0027] In a sixth aspect, embodiments of this application provide a server, the server including a memory and a processor coupled to the memory; the memory stores a computer program, and when the processor executes the computer program, it causes an electronic device to implement the method described in any one of the first aspects.
[0028] In a seventh aspect, embodiments of this application provide a communication system comprising multiple business systems, a server, and multiple databases, wherein the server is used to execute the method described in any of the first aspects above.
[0029] The solutions provided in the second to seventh aspects above are used to implement or cooperate with the methods provided in the first aspect above, and therefore can achieve the same or corresponding beneficial effects as the methods in the first aspect, which will not be elaborated here. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of the architecture of a communication system 10 provided in an embodiment of this application;
[0031] Figure 2 This is a schematic diagram of the architecture of a communication system 20 provided in an embodiment of this application;
[0032] Figure 3 This is a schematic diagram of the architecture of another communication system 20 provided in an embodiment of this application;
[0033] Figure 4 This is a partial architecture diagram of a communication system 20 provided in an embodiment of this application, including a data management plugin and a data table management plugin;
[0034] Figure 5 This is a schematic diagram of the architecture of the data table management plugin provided in the embodiments of this application;
[0035] Figure 6 This is a schematic diagram of the architecture of the data management plugin provided in the embodiments of this application;
[0036] Figure 7 This is a schematic diagram illustrating the process of the data platform provided in this application operating data tables through the data management plugin and the data table management plugin;
[0037] Figure 8 This is a partial architecture diagram of a communication system 20 including a statistical analysis plugin provided in an embodiment of this application;
[0038] Figure 9 This is a schematic diagram of the architecture of the statistical analysis plugin provided in the embodiments of this application;
[0039] Figure 10 This is a flowchart illustrating how the statistical analysis plugin provided in this application performs statistical analysis on business data.
[0040] Figure 11 This is a partial architecture diagram of a communication system 20 including a data identification bridging component provided in an embodiment of this application;
[0041] Figure 12This is a schematic diagram illustrating the process of converting business object identifiers using a data table management plugin provided in an embodiment of this application;
[0042] Figure 13 This is an example diagram of the business object identifier maintained by the data identifier bridging component provided in the embodiments of this application;
[0043] Figure 14 This is a schematic diagram of the structure of the electronic device 100 provided in the embodiments of this application;
[0044] Figure 15 This is a schematic diagram of the hardware architecture of a server 1500 provided in an embodiment of this application;
[0045] Figure 16 This is a flowchart of the multi-database management method provided in the embodiments of this application;
[0046] Figure 17 This is a schematic diagram of the structure of a multi-database management device provided in an embodiment of this application;
[0047] Figure 18 This is a schematic diagram of the structure of a chip provided in an embodiment of this application. Detailed Implementation
[0048] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to and includes any or all possible combinations of one or more of the listed items.
[0049] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0050] Currently, the business logic of many electronic devices is processed on cloud servers (also known as cloud servers or remote servers). A cloud server can run a business system and one or more databases. The database stores the business data of the electronic device, and the business system can operate on the database based on preset business logic to implement one or more business functions. This business data can include device data such as device identifiers, device models, and data generated during the operation of the electronic device.
[0051] This section first introduces a scenario where a business system directly operates on a database, as provided in an embodiment of this application. Figure 1 This is a schematic diagram of the architecture of a communication system 10 provided in an embodiment of this application.
[0052] like Figure 1 As shown, the communication system 10 includes business objects, business systems, and databases. The business systems and databases can run on cloud servers. The aforementioned business systems and databases can belong to the same physical server (or virtual server), or they can belong to different physical servers (or virtual servers), and / or multiple databases can run on the same physical server (or virtual server), or they can run on different physical servers (or virtual servers). This application embodiment does not impose any restrictions on this.
[0053] The business object can be an electronic device that provides business functions, directly carrying out the interaction with the user. The types of business objects can be diverse; for example, business objects can include mobile phones, smart sockets, robot vacuum cleaners, smart air conditioners, etc., but are not limited to these. Figure 1 The electronic devices shown may include more or fewer types of electronic devices, or the business object may be a functional module in the electronic device used to provide business functions. This application embodiment does not impose any limitations on this. The business object can transmit business data to the business system.
[0054] The business system is the main entity that executes business logic, which is used to implement one or more business functions. This business logic often involves operations such as storing, deleting, and retrieving business data from the database, as well as performing statistical operations on that data. The business system needs to perform one or more operations on the database based on this business logic. Specifically, the business system operates on the database through database commands, which can be programming statements used to interact with the database.
[0055] Databases are used to store data related to business functions, which can include business data and statistical data generated based on that business data. Multiple databases can have different data storage methods. For example, Database 1 is a MySQL database, which can use row-based storage, grouping data from the same row together. A MySQL database can contain tables composed of rows and columns for data storage. Database 2 is a MongoDB database, which can split large tables into multiple sub-tables for data storage. Database 3 is an InfluxDB database, a time-series database that can manage time-series data. Database 4 is a ClickHouse database, which can use column-based storage, storing values from the same column consecutively. Figure 1 The types of databases shown are merely examples and do not constitute a limitation of the embodiments of this application.
[0056] For example, a smart socket can count the electricity consumption of one or more electronic devices plugged into it within a preset period. This electricity consumption is a type of business data generated by the smart socket. The smart socket can send this business data (i.e., electricity consumption) to a business system. The business system can then execute the business logic of storing the electricity consumption in a database. The business system can determine the database identifier for storing the smart socket's electricity consumption, the storage location of the electricity consumption, etc., and further determine the database interface and operation method. Through the corresponding database instructions, the business system stores the electricity consumption in the corresponding database, thereby realizing this business function.
[0057] As the types of business objects increase and the diversity and complexity of business functions rise, the types of business data also increase. For example, more and more smart home devices are being developed, and these devices can perform an increasing number of business functions. Different smart home devices generate different types of business data. For instance, a smart socket might generate data on electricity consumption, a robot vacuum cleaner might generate data on a continuous range of location coordinates, and a camera might generate video or images, and so on. Furthermore, different databases are suited to different data types. Relational databases such as MySQL and PostgreSQL are better suited for managing structured data, while NoSQL databases such as MongoDB and Cassandra are better suited for processing unstructured and large-scale data. Business systems need to store business data in databases that are more suitable for the application scenarios of their business functions and the types of business data corresponding to those functions.
[0058] However, different databases have different interfaces and operation methods, requiring business systems to consider the characteristics of each database when operating on them. Furthermore, business systems may need to use different database commands for different databases. For example, a business system needs to use SQL statements when operating on a MySQL database, while using JSON statements when operating on a MongoDB database. Business systems cannot manage business data across multiple databases in a consistent manner, forcing them to couple the operational logic of different databases into their business logic. This increases the difficulty of business system development and maintenance, leading to inefficient data management.
[0059] To address the aforementioned issues, embodiments of this application provide a multi-database management method. In this method, the business system no longer directly operates on multiple databases, but instead manages them through a data platform. This eliminates the need for the business system to directly handle the differences between different databases; instead, it can operate on the databases through interfaces provided by the data platform.
[0060] The following describes scenarios where the above-mentioned multi-database management method is used. Figure 2 This is a schematic diagram of the architecture of a communication system 20 provided in an embodiment of this application.
[0061] like Figure 2 As shown, the communication system 20 includes business objects, business systems, data platforms, and databases.
[0062] The service objects and database in communication system 20 can be referred to the description in the foregoing embodiments, and will not be repeated here. For ease of description, Figure 2 In this embodiment, different business objects are distinguished by business object 1, business object 2, ..., business object M, where M is an integer greater than 1. Business object 1, business object 2, ..., business object M can contain business objects of the same type, such as business object 1 and business object 2 both being mobile phones, or they can contain business objects of different types, such as business object 1 being a mobile phone and business object 3 being a smart socket. This application does not limit the type of business object.
[0063] A business system can implement one or more business logics. When business logic requires database processing, the business system does not directly manipulate the database, but instead indirectly manipulates it by calling interfaces provided by the data platform. Specifically, the business system can distinguish business data from different business objects using business object identifiers (IDs).
[0064] The data platform serves as an intermediary layer between the business system and the database. It provides a unified interface for database operations to the business system at the top, and employs different database commands to operate on different databases at the bottom. The database operation interface provided by the data platform can be one or more plugins, which are software modules used to implement specific functions. A description of the plugins within the data platform will be provided in subsequent embodiments and will not be elaborated upon here. The data platform and the business system can belong to the same physical server (or virtual server) or different physical servers (or virtual servers); this application embodiment does not impose such limitations.
[0065] In some embodiments, the communication system 20 may further include a business description data source, which can also be a database used to cache business data of business objects. In this way, recently generated business data of a business object can be stored in the business description data source first. When a business object needs to use this part of the business data, it can directly retrieve the business data from the business description data source for operation, without needing to retrieve data from the underlying database. This improves the response speed of the business object when providing business functions and reduces the pressure on the underlying database. The business system can retrieve business data from the business description data source and store it in the underlying database based on the instructions of the business object and / or based on a preset time period. Optionally, the storage space of the underlying database can be larger than that of the business description data source, and / or the underlying database can store business data for a longer period than the business description data source. That is to say, the underlying database is used for long-term storage of business data, while historical business descriptions act as a cache for short-term storage of business data.
[0066] Understandably, in communication system 20, business systems do not need to directly interact with various databases; instead, the data platform performs the actual operations on the underlying databases. Although there may be many types of underlying databases, the interfaces provided by the data platform for operating different databases are consistent. By decoupling the business logic of the business system from the operational logic of different databases, the business system does not need to consider the differences in the interfaces and operation methods of the underlying databases. It only needs to call a unified interface to instruct the data platform to operate on the database. This reduces the difficulty of developing and maintaining the business system and improves the efficiency of business data management.
[0067] The multi-database management method proposed in this application is not limited to the scenario shown in the communication system 20 above. It can also be used in other scenarios where data needs to be stored in different databases for management, such as data warehouses, data lakes, cross-departmental data sharing, and multi-cloud environment data management. This application does not limit the scenarios in which the multi-database management method can be used. A data warehouse is a system for storing and managing large amounts of historical data, typically used for business intelligence and data analysis. Data in a data warehouse usually comes from multiple heterogeneous data sources. A data lake is a system for storing large amounts of sample data, typically used for big data analysis and machine learning. Data in a data lake usually comes from multiple sources and may need to be stored in different database systems. In cross-departmental data sharing, different departments within an enterprise may use different database systems to manage their respective business data. For example, the sales department uses a MySQL database to manage sales data, the marketing department uses a PostgreSQL database to manage marketing activity data, and the R&D department uses a MongoDB database to manage product development data. Multi-cloud environment data management refers to the increasing number of enterprises choosing to store data in the cloud as cloud computing becomes more widespread. Enterprises may use multiple cloud service providers to store and manage data, and these cloud service providers may use different database systems. The above scenarios all require the use of different databases and face the same problem as the business system in communication system 20: how to manage data in different databases. Therefore, the multi-database management method provided in this application embodiment is applicable to all of the above scenarios. The method of using the multi-database management method provided in this application embodiment in the above scenarios can refer to the multi-database management method in communication system 20, and this application embodiment does not impose any limitations on it.
[0068] The following section details how business systems manage business data through a data platform.
[0069] Figure 3 This is a schematic diagram of the architecture of another communication system 20 provided in an embodiment of this application. Wherein, Figure 3 The communication system 20 shown will Figure 2 The data platform in the communication system 20 shown will be described in detail. (About...) Figure 3 For an introduction to business objects, business systems, data platforms, underlying databases, and business description data sources, please refer to the preceding text. Figure 2 The illustrated embodiment is described below. Figure 3 As shown, a business system can contain functional modules for running one or more business logics.
[0070] The data platform may include a business logic plugin configuration service, a plugin registration center, a data identifier bridge construction, and a plugin integration center.
[0071] The business logic plugin configuration service provides an entry point for configuring plugins in business systems. This service can contain one or more configuration files, each of which can be used to configure the database operation types required by a business logic and one or more parameters for implementing those operations. Database operation types may include, for example, storing data, reading data, deleting data, creating a data table, deleting a data table, etc. One or more parameters may include, but are not limited to, business identifier ID, table name, partitioning unit, database type, data expiration time, column names, and data types for each column. Depending on the type of database operation to be implemented by the business logic, the parameters required by the corresponding plugin may differ. The plugin types mentioned above may include data management plugins, data table management plugins, and statistical analysis plugins. These three types will be discussed later and will not be elaborated upon here. The plugin type configured for each business logic and the parameters required by the plugin can be preset or dynamically modified by the business system based on the running status of business functions. The configuration of business logic parameters is not limited to configuration through configuration files; it can also be done through configuration tables. This application embodiment does not limit the method for configuring business logic parameters.
[0072] The plugin registry center is used to register plugins in the plugin integration center and to retrieve the corresponding plugins from the plugin integration center based on the configuration files in the business logic plugin configuration service. Registering a plugin associates it with the functionality it performs, so that when a business system instructs the data platform to perform a database operation, the data platform can retrieve the corresponding plugin to implement that operation.
[0073] For plugins that perform the same function across different databases, the Business Logic Plugin Configuration Service can construct a unified and consistent parameter structure and definition for configuring these plugins. In other words, the parameters required for a business system to perform the same operation on different databases are consistent, allowing the business system to operate on the database without needing to know the database type. The business system only needs to modify the parameters configured in the Business Logic Plugin Configuration Service to switch the data processing object.
[0074] For example, when it's necessary to change the database on which data is written, the business system can directly change the database type corresponding to the business logic in the business logic plugin configuration service without changing other parameters. The plugin registry center can then switch the plugin based on the modified configuration to enable the function of writing data to another database. This eliminates the need for additional modifications to the business system's business logic, allowing the data processing object to be changed at any time during business system operation by altering configuration parameters, thus improving the flexibility of data management.
[0075] As the types and functionalities of business objects increase, business systems may need to store data in new databases for management. When a new database is required, developers do not need to change the business logic of the business system; they only need to add a plugin for the new database and reconfigure the database corresponding to the business logic. This makes the business system more scalable.
[0076] The plugin registration center provides plugin implementations and a unified parameter structure for plugins built for different databases. Together, they reduce the difficulty of managing data in business systems.
[0077] The plugin integration center can contain various types of plugins, including data management plugins, statistical analysis plugins, and data table management plugins.
[0078] The data management plugin can be used to write, delete, and read data from tables in a database. There can be multiple data management plugins, and one plugin can perform data operations on a specific database. In other words, a data management plugin encapsulates methods for operating on a particular database. For example, data management plugin 1 can be used to write and delete data into tables in a MySQL database, while data management plugin 2 can be used to write and delete data into tables in a MongoDB database.
[0079] Data table management plugins can be used to create and delete data tables. Multiple data table management plugins can exist, and one plugin can be used to perform data table operations for a specific database. For example, data table plugin 1 can be used to create data tables in a MySQL database, and data table plugin 2 can be used to create data tables in a MongoDB database.
[0080] Statistical analysis plugins can perform a series of mathematical operations on business data based on preset statistical analysis logic, thereby achieving statistical analysis of the business data. This statistical analysis logic can include basic descriptive statistics such as finding the maximum, minimum, average, or median, as well as more complex statistical analysis methods, such as principal component analysis, time series forecasting, automated association mining, Bayesian network causal inference, etc. Multiple statistical analysis plugins can exist, and one plugin can be used to perform statistical analysis on business data from one type of database. For example, statistical analysis plugin 1 is used to find the maximum value of multiple business data stored in MongoDB using the maximum value function (MAX), statistical analysis plugin 2 is used to find the average value of multiple business data stored in MySQL using the average value function (AVG), and so on.
[0081] The input parameters for each plugin can be the intersection of the parameters required by different business logics for the same database operation on different databases. This ensures that the input parameters are consistent when different business logics perform the same database operation on different databases, thus minimizing the differences in the implementation of each plugin and reducing the maintenance cost for business system maintenance personnel to learn how to use the plugins.
[0082] Data identification bridging components eliminate the discrepancies between business description data sources and underlying databases, facilitating consistent management of business data by business systems. For example, some business objects may have their business object identifiers stored in the business description data source as strings (String type). However, the database storing the business data of these objects might not support the String type. The data identification bridging component can convert the business object identifier in the business description data source into a data type supported by the underlying database and store it in the corresponding database. When business logic searches for the business data of a specific business object based on a String type, the data identification bridging component can then convert the String business identifier back into its stored identifier in the database. Thus, for the business system, it only needs to focus on the business object identifier stored in the business object description data source. The data identification bridging component handles the conversion from the business object identifier in the business object description data source to the business object identifier stored in the underlying database, thereby reducing the complexity of data management for the business system.
[0083] Not limited to Figure 3 The data platform shown may contain more or fewer software modules, or combine certain software modules, or add certain software modules, etc., and this application embodiment does not limit this. For example, the data platform may also include a connection management module for establishing connections with various databases, etc.
[0084] The software modules in the data platform will be described in more detail below.
[0085] I. Data Management Plugin and Data Table Management Plugin
[0086] Figure 4 This is a partial architecture diagram of a communication system 20 provided in an embodiment of this application, including a data management plugin and a data table management plugin. For example... Figure 4 As shown, for ease of explanation and better understanding, Figure 4 Only a partial architecture of the communication system 20 is shown. The business system manages the data tables in the database by calling the data table management plugin in the data platform, and manages the business data in the data tables by calling the data management plugin. The data table plugin can be directly called by the business logic, while the data table management plugin can be called by the data management plugin under specific logic.
[0087] The data management plugin and the data table management plugin will be introduced separately below.
[0088] Figure 5 This is a schematic diagram of the architecture of the data table management plugin provided in an embodiment of this application. For example... Figure 5 As shown, the data table management plugin may include a database identification module, a data table existence judgment module, a data table creation module, and a data table deletion module.
[0089] The database identification module is used to identify the database type to which the data table management plugin is applicable, and it encapsulates the logic for operating on a data table in a specific database.
[0090] The data table existence check module is used to determine whether one or more data tables exist in the database.
[0091] The data table creation module is used to create data tables in the database.
[0092] The data table deletion module is used to delete data tables in the database.
[0093] In a database, tables can be defined and described using multiple table parameters. These parameters may include, but are not limited to: table name, column names, data types for each column, data expiration time, and table partitioning unit.
[0094] The table name is the name or identifier of the data table.
[0095] Each data column name is the name of the corresponding data column in the data table where the business data is stored.
[0096] The data type corresponding to each data column is also known as the data type of the data column, such as the data column being of type String, integer, date and time, etc.
[0097] Data expiration time refers to the length of time a piece of business data is stored in a data table. When the data storage time exceeds the data expiration time, the business data will be deleted from the database.
[0098] The partitioning unit indicates the partitioning method used at the underlying level of the data table. The partitioning methods mentioned above can include no partitioning, partitioning by day, partitioning by month, and partitioning by year, etc.
[0099] In the data table management plugin, each module can require different data table parameters to perform its functions. Figure 5 Different arrows indicate the data table parameters required for each software module to be used. It should be noted that the data table parameters received by the data table management plugin are configured in the business logic plugin configuration service.
[0100] The data table management plugin's data table existence check module can receive configurations regarding the data table name and partitioning unit to determine if the data table exists. For example, if the partitioning unit is set to monthly, the plugin can query whether the data table for each month has the same name, thus confirming the existence of the data table.
[0101] The data table deletion module can receive configurations regarding the data table name and partition unit, and then delete the data table.
[0102] The data table creation module can receive the data table name, column names, data types, expiration time, and table partitioning unit to create and configure the data table.
[0103] The data management plugins for different databases require the same parameters. This allows maintenance personnel of business systems to use data management plugins for different databases with consistent parameters, reducing the complexity of managing business data.
[0104] Figure 6 This is a schematic diagram of the architecture of the data management plugin provided in an embodiment of this application. For example... Figure 6 As shown, the data table management plugin can include a database identification module, a data storage module, a data reading module, and a data deletion module.
[0105] The database identification module is used to identify the type of database to which the data management plugin is applicable and which database the data management plugin encapsulates the logic for operating on data.
[0106] The data storage module is used to store business data into data tables.
[0107] The data reading module is used to read business data from the data table.
[0108] The data deletion module is used to delete business data from the data table.
[0109] In this context, data tables in a database can be defined and described using multiple data parameters. These parameters may include, but are not limited to, data identifiers (IDs), data item structures, and data timestamps.
[0110] A data identifier (ID) is an identifier for business data, used to distinguish one piece of business data from other business data. Different databases may support different data types and structures for these identifiers; therefore, the data type of the data identifier (ID) needs to be adapted based on the data types supported by the database.
[0111] Data time refers to the moment when the data was generated.
[0112] A data item structure can contain the business data to be stored and the column names of the data columns to be stored. Specifically, the data item structure can store the aforementioned business data and its corresponding column names using a key-value pair (Map) structure.
[0113] In the data management plugin, each module may require different parameters to achieve its function. Figure 6 Different arrows indicate the parameters that need to be passed in when using each software module.
[0114] like Figure 6 As shown, the data storage module can receive data table parameters and data parameter configurations, and then store the business data. The data table parameters are used to determine the data table in which the business data will be stored, and the data parameters can include the business data to be stored and its related information.
[0115] The data reading module can receive configurations such as the start time of data storage, the end time of data storage, the page number to be read in the data table, and the size of each page. This allows it to determine which time period of business data to read, the page number to read, and the amount of business data to read per page. Alternatively, the data reading module can also receive only a data identifier ID and read the business data corresponding to that specific data identifier ID.
[0116] The data deletion module can receive data table parameters and the start and end times of data storage to determine which part of the business data in which data table should be deleted. Alternatively, the data reading module can receive only a data identifier ID and delete the business data corresponding to that specific data identifier ID.
[0117] The parameters required by the table management plugins for different databases are consistent. For example, Table Management Plugin 1 can be used to manage tables in a MySQL database, and Table Management Plugin 2 can be used to manage tables in a MongoDB database. The parameters required by both plugins are identical; for instance, when deleting a table in the database, both plugins accept the table name and partition unit as input to delete the corresponding table. This allows maintenance personnel of the business system to use table management plugins for different databases with consistent parameters, thereby reducing the learning cost for technical personnel developing and maintaining the business system and lowering the complexity of managing business data.
[0118] The following describes the specific process of how the data management plugin and the data table management plugin operate on data tables.
[0119] Figure 7 This is a schematic diagram illustrating the process of the data platform provided in this application operating data tables through data management plugins and data table management plugins. For example... Figure 7 As shown, the process of manipulating data tables through the data management plugin and data table management plugin of the data platform may include, but is not limited to, the following steps:
[0120] S701. Determine the database operation type corresponding to the business logic.
[0121] The data platform can first read the parameters configured by the business system in the business logic plugin configuration service. This service can contain one or more configuration files, which are used to configure the database type, database operation type, and a series of parameters required to complete the database operation. For example, the service might contain configuration file 1, which is associated with business logic 1. Configuration file 1 can store the database type required by business logic 1 (e.g., whether it's an operation on a MySQL database or a MongoDB database), the required database operation type, etc. These database operation types could include storing data in the database, reading data from the database, and deleting data from the database. The table parameters, data parameters, start and end times, page numbers, and page sizes can all be configured in the business logic plugin configuration service. The parameters required to complete each database operation can be different, as described above. Figure 5 , Figure 6 Description of the illustrated embodiment.
[0122] When the database operation type is data storage, the data platform can execute step S702.
[0123] When the database operation type is read data, the data platform can execute step S710.
[0124] When the database operation type is data storage, the data platform can execute step S720.
[0125] S702, Obtain data storage parameters and business data to be stored.
[0126] When the database operation type is "store data," the data platform can receive business data to be stored sent by the business system. This business data can be data uploaded to the business system and then directly sent to the data platform by the business system; alternatively, it can be data uploaded to a business description data source, retrieved by the business system from the business description data source, and then sent to the data platform. The data storage parameters are... Figure 6 The data storage module shown stores the parameters required for business data in the database, including data table parameters and data parameters.
[0127] S703, Invoke the data management plugin corresponding to the business logic.
[0128] The plugin registry center in the data platform determines the database type and database operation required by the business logic based on the configuration file, and then calls the corresponding data management plugin to implement the operation. For example, if configuration file 1 indicates that business logic 1 needs to store data in database 1, the plugin registry center can call the data management plugin 1 corresponding to database 1 to perform the data storage operation in database 1. Specifically, the plugin registry center can determine that data management plugin 1 is used to operate on database 1 through the database identification module in data management plugin 1.
[0129] S704: Call the data table management plugin to determine if the data table exists.
[0130] The data table management plugin can determine whether a data table exists through the data table existence detection module. If the data table exists, proceed to step S705; if the data table does not exist, proceed to step S706.
[0131] S705, the data management plugin writes business data into the database.
[0132] The data management plugin can store business data into a specified database through the data storage module.
[0133] S706, Data Table Management Plugin: Create Data Tables.
[0134] The data table management plugin allows users to create and configure data tables through the data table creation module. This configuration can include, for example, creating indexes, designing table naming rules, data lifecycle settings, read throughput, write throughput, and so on.
[0135] S707. Confirm whether the data table has been created successfully.
[0136] If the data table is created successfully, the data platform can execute step S708; if the data table is not created successfully, the data platform can execute step S709.
[0137] S708, the data management plugin writes business data into the database.
[0138] The data management plugin can write (i.e., store) business data into the database through the data storage module. Once S708 is completed, the process branch corresponding to the stored data will end.
[0139] S709, the data table management plugin deletes data tables that failed to be created.
[0140] The data table management plugin allows users to delete data tables that failed to be created using the data table deletion module. Once S709 is completed, the process branch corresponding to the stored data ends.
[0141] In some embodiments, after the data table management plugin deletes a data table that failed to be created, it can return to step S706 until the data table is successfully created.
[0142] S710, Obtain data reading parameters.
[0143] S711, invoke the data management plugin to read business data.
[0144] Among them, the data reading parameters are also Figure 6 The data reading module shown provides parameters required for deleting business data. These parameters can include data table parameters, the start time of data storage, the end time of data storage, the page number to be read in the data table, and the size of each page (i.e., the number of data items per page). Alternatively, the data reading parameters can also include a data identifier ID. Furthermore, the data reading module in the data management plugin can read business data based on these parameters. These data reading parameters can be configured in the configuration file corresponding to the business logic within the business logic plugin configuration service.
[0145] Once S711 is executed, the process branch corresponding to the data read will end.
[0146] S720, Get data deletion parameters.
[0147] S721, Call the data deletion plugin to delete business data.
[0148] Among them, the data deletion parameter is... Figure 6 The data deletion module shown retrieves the parameters required for deleting business data. These parameters may include data table parameters, the start time of data storage, the end time of data storage, or, alternatively, a data identifier ID. Furthermore, the data deletion module in the data management plugin can read business data based on these parameters. These data deletion parameters can be configured in the configuration file corresponding to the business logic within the business logic plugin configuration service.
[0149] Once S721 is executed, the process branch corresponding to the deleted data will be terminated.
[0150] II. Statistical Analysis Plugin
[0151] Figure 8 This is a partial architecture diagram of a communication system 20 including a statistical analysis plugin, provided in an embodiment of this application. For example... Figure 8 As shown, for ease of explanation and better understanding, Figure 8 Only a partial architecture of the statistical analysis plugin in communication system 20 is shown. Business logic in the business system can directly call the statistical analysis plugin to perform statistical analysis on business data. In some embodiments, the business data used by the statistical analysis logic can be obtained from the underlying database by the data management plugin.
[0152] Figure 9 This is a schematic diagram of the architecture of the statistical analysis plugin provided in an embodiment of this application. For example... Figure 9 As shown, the statistical analysis plugin can receive statistical parameters as input and then execute statistical logic to obtain statistical results. Specifically, the statistical analysis plugin can include a database identification module, a statistical logic implementation module, and a statistical logic identifier.
[0153] The database identification module is used to identify the type of database to which the statistical analysis plugin is applicable, that is, to determine which database the statistical analysis plugin is used to perform statistical calculations on the business data stored therein.
[0154] The statistical logic implementation module contains the specific statistical logic used to perform statistical calculations on business data. This module can encapsulate specific implementation methods for performing statistical logic calculations on data from a particular database.
[0155] The statistical logic identification module is used to identify the type of statistical logic executed by the statistical analysis plugin, and to indicate the statistical logic that the statistical analysis plugin can implement.
[0156] The data platform can determine which database a statistical analysis plugin can be used to perform which statistical analysis on using the database identification module and the statistical logic identification module. For example, if the database identification module of a statistical analysis plugin indicates that the plugin is applicable to a MySQL database, and the statistical logic identification module indicates that the plugin is used to calculate averages, the data platform can determine that the plugin is used to calculate the average of business data stored in the MySQL database.
[0157] The statistical parameters received by the statistical analysis plugin may include, but are not limited to, the location of the data and the type of statistical logic. The location of the data can be represented by parameters such as the identifier of the statistical object (i.e., one or more business objects to be analyzed), the start time of the statistics, the end time of the statistics, and the location of the data generated by the statistical object in the database.
[0158] The identifier of the statistical object is, in other words, the identifier ID of the business object to be statistically analyzed in the database. Here, the statistical object could be, for example,... Figure 1 The electronic devices shown include, for example, smart sockets and smart air conditioners. The statistical analysis plugin needs to determine which business object's data to analyze based on the identifier of the statistical object.
[0159] The location of the statistical object's data in the database can be determined by several parameters, including but not limited to database type, table name, column name, and data type. The data of the statistical object refers to the business data related to that object, which can be... Figure 1 The business data reported by the electronic devices shown, such as the power consumption recorded by the smart socket, etc.
[0160] The statistical start time and statistical end time of the statistical object, that is, the start and end time of the business data to be statistically analyzed for the statistical object.
[0161] Statistical logic type, used to indicate the type of statistical logic.
[0162] The parameters that the statistical analysis plugins for different databases need to receive are consistent.
[0163] Figure 10 This is a flowchart illustrating how the statistical analysis plugin provided in this application performs statistical analysis on business data. For example... Figure 10 As shown, the statistical analysis plugin can perform statistical analysis on business data in steps including but not limited to the following:
[0164] S1001, Obtain statistical parameters.
[0165] The statistical analysis plugin can first obtain statistical parameters, which can be configured in the business logic plugin configuration service.
[0166] S1002. Read the business data of the statistical object to be statistically analyzed.
[0167] The statistical analysis plugin can determine the data table and statistical object to be statistically analyzed by identifying the statistical object and the location of the statistical object's data in the database. Then, the statistical analysis plugin can read the business data from the statistical start time to the statistical end time from the data table for subsequent statistics.
[0168] The business data of the statistical objects to be statistically analyzed can come from the same database or different databases. Alternatively, the business data of the statistical objects to be statistically analyzed can come from the same or different data tables. There can also be multiple statistical objects. This application embodiment does not limit this.
[0169] S1003, Execute statistical logic on business data.
[0170] After obtaining the business data to be statistically analyzed, the statistical analysis plugin can execute specific statistical logic on the business data through the statistical logic implementation module. For example, in step S1002, the statistical analysis plugin retrieves the hourly electricity consumption reported by the smart socket within a specific time period (such as a day) stored in the database. After obtaining the hourly electricity consumption reported by the smart socket for that day, the statistical analysis plugin can obtain the final statistical result (i.e., the hourly electricity consumption for that day) based on its preset statistical logic (such as calculating the average value).
[0171] S1004, Store statistical results.
[0172] Finally, the statistical analysis plugin can store the statistical results in a database or send them to business objects. The business logic plugin configuration service can also configure the database type, column names, column types, etc., for storing the statistical results, allowing the statistical analysis plugin to store the results in a preset location based on these configurations.
[0173] The business logic plugin configuration service allows you to configure a series of parameters required for statistical analysis. These parameters may include the database type required for the statistical analysis, the statistical logic to be implemented, and the identifier of the statistical object. A list of parameters required for statistical analysis can be found above. Figure 9 The description of the illustrated embodiment will not be repeated here. When a business system executes business logic that includes statistics, the business system can call the statistical analysis plugin provided by the data platform to achieve statistical analysis.
[0174] III. Data Identification Bridging Components
[0175] Figure 11This is a partial architecture diagram of a communication system 20 including a data identification bridging component, provided in an embodiment of this application. For ease of explanation and better understanding, Figure 11 Only a partial architecture of the data identification bridging component in the communication system 20 is shown.
[0176] The data identification bridging component maintains the mapping between business data in the business description data source and the underlying database. Understandably, when a business object has stored its business data in the business description data source, the data type of the business data stored there (e.g., the business object's identifier ID) might be unsupported by the underlying database. Therefore, when the data platform retrieves business data from the business object description data source and stores it in the underlying database, it needs to convert the business object's identifier ID into a data type that the underlying database can recognize. The data platform can generate database-supported business object identifiers through a data table management plugin. The data identification bridging component then maintains the mapping between the business object identifiers stored in the business object description data source and those stored in the underlying database. When business logic calls the plugin, it uses the business object identifier from the business object description data source. The data identification bridging module can then convert this identifier back to the business object identifier used when the business object is stored in the underlying database and pass it to the plugin.
[0177] For example, such as Figure 12 As shown, the data table management module can include an identifier generation module. After receiving the identifier of a business object from the business description data source, the identifier generation module can convert it into an identifier that the underlying database can recognize. For example, if the identifier of business object 1 in the business description data source is device123, the identifier generation module can convert the identifier based on the database type. MongoDB and MySQL support String type data identifiers, so business object 1 can still be identified as String type device123 in the underlying MongoDB and MySQL databases. However, InfluxDB and SQLite databases do not support String type identifiers. Therefore, the identifier generation module can convert device123 into a data type that the aforementioned databases can recognize. For example, it can convert device123 into a data point that InfluxDB can understand, such as converting it into a timestamp → measurement item (i.e., raw data metadata) → key-value pair (dev_id, device123). The identifier generation module can also convert device123 into data of a data type supported by SQLite, such as 3421824123.
[0178] Figure 13 This is an example diagram of the business object identifier maintained by the data identifier bridging component provided in this application embodiment. That is to say, the data identifier bridging component can store the correspondence between the identifier of the business object in the business description data source and the identifier of the business object in the underlying database. Figure 13 Taking the business object "device123" as an example, when the business logic of this business object calls a plugin in the plugin integration center, the data identification bridging component can pass the corresponding stored value "3421824123" for "device123" in the SQLite database to the plugin. The plugin can then operate on the business data of the business object "device123" based on "3421824123". Figure 13 As can be seen, the same business object can have different identifiers in different databases. The data identifier bridging component can maintain the mapping between the identifiers of a business object in each database. In this way, when a business system manages the business data of a specific business object, the business system does not need to worry about the actual identifier used by that business object in the database. Instead, it can manage the data of that business object stored in different databases through a unified identifier. Specifically, the data identifier bridging component is responsible for the conversion between the identifier used by the business system and the identifier stored in the specific database, thereby reducing the difficulty of data management for the business system.
[0179] The conversion is not limited to the identification of business objects. When other business data is inconsistent in the data type stored in the business object description data source and the underlying database, the data table management plugin can also convert other business data. In this way, the data identification bridging component can maintain the correspondence between the business data stored in the business object description data source and the underlying database, and pass the converted business data to the plugin when the business system calls the plugin. This application embodiment does not limit this.
[0180] The conversion of business object identifiers is not limited to the data table management plugin module; it can also be done by other software modules. This application embodiment does not impose any restrictions on this.
[0181] The following describes an exemplary electronic device 100 provided in an embodiment of this application.
[0182] Figure 14 This is a schematic diagram of the structure of the electronic device 100 provided in the embodiments of this application.
[0183] In this embodiment, electronic device 100 can be a smart terminal device of various types, and the specific type is not limited in this application. Electronic device 100 can be the business objects mentioned in the foregoing embodiments, such as mobile phones, smart sockets, robot vacuum cleaners, and smart air conditioners. It is not limited to this; electronic device 100 can also be a tablet computer, desktop computer, laptop computer, handheld computer, smart screen, augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, smart headphones, game console, or sports and health monitoring devices such as smartwatches, smart bracelets, etc. Alternatively, electronic device 100 can also be other Internet of Things (IoT) devices or smart home devices such as smart TVs, laptops with touch-sensitive surfaces or touch panels, desktop computers with touch-sensitive surfaces or touch panels, and other non-portable terminal devices, etc.
[0184] The following describes the embodiment using electronic device 100 as an example. It should be understood that electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have different component configurations. Figure 14 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0185] Electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, antenna 1, wireless communication module 160, sensor module 180, etc.
[0186] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0187] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0188] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0189] The wireless communication function of electronic device 100 can be implemented through antenna 1, wireless communication module 160, modem processor and baseband processor, etc.
[0190] Antenna 1 is used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization.
[0191] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 1, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 1.
[0192] In some embodiments, antenna 1 and wireless communication module 160 are coupled, enabling electronic device 100 to communicate with networks and other devices via wireless communication technologies. The wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).
[0193] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0194] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application required for a function (such as facial recognition, fingerprint recognition, mobile payment, etc.). The data storage area may store data created during the use of electronic device 100 (such as facial information template data, fingerprint information templates, etc.). Furthermore, internal memory 121 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0195] In this embodiment, the electronic device 100 can connect to the cloud server through the antenna 1 and the wireless communication module, and then send business data to the business system in the cloud server, etc.
[0196] Figure 15 This is a schematic diagram of the hardware architecture of a server 1500 provided in an embodiment of this application.
[0197] Server 1500 is the cloud server mentioned in the previous embodiment. Server 1500 may run one or more of the following: business system, data platform and underlying database.
[0198] like Figure 15 As shown, server 1500 includes: one or more processors 1501, memory 1502, communication interface 1503, transmitter 1505, receiver 1506, coupler 1507, and antenna 1508. These components can be connected via bus 1504 or other means. Figure 15 Taking a connection via bus 1504 as an example: Where:
[0199] The processor 1501 can be used to read and execute computer-readable instructions. Specifically, the processor 1501 can be used to call programs stored in the memory 1502, such as the program implemented in the server 1500 for the method of managing business data by the business system and data platform provided in the embodiments of this application. For details on the method executed by the processor 1501, please refer to the description of the method of processing business data by the business system and data platform above, which will not be repeated here.
[0200] The memory 1502 is coupled to the processor 1501 and is used to store various software programs and / or multiple sets of instructions. Specifically, the memory 1502 may include high-speed random access memory and may also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
[0201] The memory 1502 can store an operating system (hereinafter referred to as the system), such as uCOS, VxWorks, RTLinux, and other embedded operating systems. The memory 1502 can also store network communication programs, which can be used to communicate with electronic devices 100 and 200. The memory 1502 can also store configuration information for various storage tasks, data dictionaries, etc.
[0202] The communication interface 1503 can be used by the server to communicate with other communication devices, such as electronic devices 100 and 200. Specifically, the communication interface 1503 can be a 3G communication interface, a Long Term Evolution (LTE) (4G) communication interface, a 5G communication interface, a WLAN communication interface, a WAN communication interface, etc.
[0203] In some embodiments of this application, transmitter 1505 and receiver 1506 can be considered as a wireless modem. Transmitter 1505 can be used to transmit signals output by processor 1501. Receiver 1506 can be used to receive signals. In a server, the number of transmitters 1505 and receivers 1506 can be one or more. Antenna 1508 can be used to convert electromagnetic energy in a transmission line into electromagnetic waves in free space, or to convert electromagnetic waves in free space into electromagnetic energy in a transmission line. Coupler 1507 can be used to split mobile communication signals into multiple paths and distribute them to multiple receivers 1506. Understandably, the antenna 1508 of the network device can be implemented as a massive MIMO (Massively Multi-Analog Device) array.
[0204] Figure 16 This is a flowchart of the multi-database management method provided in the embodiments of this application, such as... Figure 16 As shown, this method may include, but is not limited to, the following steps:
[0205] S1601. The first business function is detected to be started. The first business function includes program code that calls the first interface. The first interface encapsulates the function of performing the first operation on multiple databases. One or more business functions include the first business function.
[0206] This method is applied to a server in a first communication system, which may be, for example, the aforementioned communication system 20. The first communication system may include a server, multiple business objects, and multiple databases. The first business object may be, for example, a business object 1 within the communication system 20. The server has one or more business functions corresponding to business logic. The databases are used to manage the data of the multiple business objects.
[0207] The business system in the server can detect the startup of the first business function, which means that the business logic corresponding to the first business function is started. The first business logic can be started by the business system after receiving a request from a business object to acquire the first business function. For example, a business object such as a mobile phone instructs the business system to read business data from other business objects such as IoT devices. Alternatively, the first business logic can also be started by the business system based on its own logic, such as the business system uploading business data to the database at preset intervals. This application embodiment does not limit the method of starting the first business function.
[0208] The business logic corresponding to the first business function includes program code that calls the first interface. This first interface could be, for example, an interface provided by the data platform for calling plugins. This plugin could be, for example, the data management plugin, statistical analysis plugin, etc., as described in the previous embodiments. After the business system calls the first interface, the data platform will select an appropriate plugin based on the parameters passed to the first interface to perform corresponding operations on the database.
[0209] S1602. Call the first interface through the first business function and pass the identifier of the first database to the first interface. Multiple databases include the first database.
[0210] The business system can invoke the first interface through the program code that calls the first interface within the first business function. When invoking the first interface, the business system also passes in an identifier for the first database. This identifier indicates that the first business function needs to operate on the first database among multiple databases. The identifier for the first database can be configured in a configuration file or table provided by the business logic plugin configuration service and passed in response to the business system's call to the first interface.
[0211] S1603. Select the first function from the functions of performing the first operation on multiple databases encapsulated in the first interface by using the identifier of the first database. The first function is the function of performing the first operation on the first database.
[0212] The plugin registration center can select the plugin that performs the first operation on the first database from multiple plugins encapsulated by the first interface based on the identifier of the first database to achieve the first function. The above selection of a plugin from multiple plugins is the selection of the first function.
[0213] S1604, Run the first function.
[0214] The data platform can run the first function, which means running the plugin that implements the first function.
[0215] In some embodiments, the first interface encapsulates the function of writing data to multiple databases respectively. Before calling the first interface through the first business function and passing the identifier of the first database to the first interface, the method further includes: receiving the first data of the first business object, wherein the multiple business objects include the first business object.
[0216] In some embodiments, when passing an identifier of a first database to a first interface, the method further includes: passing first data to the first interface; and running a first function, including: writing the first data to the first database.
[0217] With the first interface encapsulating the function of writing data to the database, the server can receive first data from the first business object. For example, the first data can be business data to be stored by the first business object. Therefore, when the business system passes the identifier of the first database to the data platform, it also needs to pass the first data to the first interface. Then, the first interface can write the first data to the first database. The first interface can implement the first function by calling the interface of the data management plugin. When calling the first interface, the business system can also pass other parameters to the first interface. Referring to the description of the input parameters of the data storage module in the data management plugin in the previous embodiments, this application embodiment does not limit the parameters that the business system can pass when calling the first interface.
[0218] In some embodiments, if the first data table does not exist in the first database, the first function further includes creating the first data table for the first database before running the first function, the first data table being used to store the first data.
[0219] Even if the first data table does not exist in the first database, the first interface can still create the first data table. Specifically, the first interface can create the first data table by calling the data table management plugin through the data management plugin. The method for the first interface to call the data table management plugin through the data management plugin can be found in the previous section. Figure 7 The descriptions of S702-S709 in the embodiments will not be repeated here.
[0220] In some embodiments, the first interface encapsulates the function of reading data from multiple databases respectively. When the identifier of the first database is passed to the first interface, the method further includes: passing the first position of the second data in the first database to the first interface; running the first function, including: reading the second data from the first database based on the first position.
[0221] When the first interface is used to read data from the database, the business system can also pass the identifier of the first database and the first position of the second data to be read in the first database to the first interface when calling the first interface. Referring to the description of the input parameters of the data reading module in the aforementioned data management plugin, the first position can be determined, for example, by the start and end time of data storage, the page number of data storage, and the amount of data read per page, or it can be determined by the data identifier ID. This application embodiment does not limit this. Furthermore, the data platform can read the second data from the first database by calling the data management plugin corresponding to the first database, referring to the aforementioned... Figure 7 S710-S711 in the illustrated embodiment.
[0222] In some embodiments, after reading second data from a first database based on a first location, the method further includes: sending the second data to a second business object, wherein the plurality of business objects include the second business object.
[0223] After reading the second data, the data platform can also report the second data to a second business object. This second business object can be a business object that queries the business system for the second data. For example, in a scenario where a mobile phone queries the business system for the electricity consumption collected by a smart socket, the mobile phone can be considered the second business object, and the electricity consumption collected by the smart socket can be considered the second data.
[0224] In some embodiments, the first interface encapsulates the function of deleting data from multiple databases. When the identifier of the first database is passed to the first interface, the method further includes: passing the second position of the third data in the first database to the first interface; and running the first function, including: deleting the third data from the first database based on the second position.
[0225] When deleting data from multiple databases using the first interface, the business system, when calling the first interface, also passes in the second position of the third data to be deleted in the first database. Referring to the parameters required by the data deletion module in the data management plugin of the aforementioned embodiment, the second position can be represented by the data identifier ID of the third data, or it can also be represented by data table parameters, the start time and end time of data storage. It is not limited to the above parameters; other parameters can also be used to query the position of the third data to be deleted. This application embodiment does not impose any limitations on this. Furthermore, the data platform will select the data management plugin used to manage the first database to delete the third data from the first database.
[0226] In some embodiments, the first interface encapsulates the function of statistical analysis of data from multiple databases. When the identifier of the first database is passed to the first interface, the method further includes: passing the third position of the fourth data in the first database and the identifier of the first statistics to the first interface; running the first function, including: reading the fourth data based on the third position; and performing the first statistics on the fourth data based on the identifier of the first statistics.
[0227] With the statistical analysis function encapsulated in the first interface, when the business system calls the first interface, it needs to pass in the third position of the fourth data to be statistically analyzed in the first database, as well as the identifier of the first statistical analysis. The first statistical analysis is also the identifier of the statistical logic to be executed, such as calculating the average, finding the maximum value, principal component analysis, etc. The data platform can call the statistical analysis plugin to perform statistical analysis on the fourth data in the first database.
[0228] In some embodiments, when a first interface is called through a first business function and an identifier of a first database is passed to the first interface, the method further includes: passing a first parameter to the first interface; determining a second parameter corresponding to the first parameter from a first mapping table based on the identifier of the first database, wherein the first mapping table stores original parameters corresponding to multiple input parameters of the first database, the original parameters including the first parameter, and the original parameters are generated by a business object.
[0229] The original parameters could be, for example, the business object identifier generated by the business object, and the input parameters could be, for example, business object identifiers supported by the database. The first mapping table can be maintained by a data identifier bridging component, and the first mapping table is, for example, as shown in the example below. Figure 13 The data identifier bridging component shown maintains the following information: the first parameter is, for example, device123, and the second parameter is the business identifier supported by the first database, such as 3421824123 for an SQLite database, etc. Furthermore, the data platform can determine the second parameter corresponding to the first parameter through the data identifier bridging component.
[0230] The apparatus for performing the above method provided in the embodiments of this application will now be described. Figure 17 As shown, Figure 17 This is a schematic diagram of the structure of a multi-database management device provided in an embodiment of this application. The multi-database management device may be the server in the embodiments of this application, or a chip or chip system within the server.
[0231] like Figure 17 As shown, the multi-database management device 1700 may include a business function processing unit 1701, an interface calling unit 1702, a database operation unit 1703, and a communication unit 1704, wherein the multi-database management device 1700 has one or more business functions.
[0232] The business function processing unit 1701 is used to detect the start of a first business function, which includes program code that calls a first interface. The first interface encapsulates functions that perform first operations on multiple databases, and one or more business functions include the first business function. The interface calling unit 1702 is used to call the first interface through the first business function and pass the identifier of the first database to the first interface. The multiple databases include the first database. The interface calling unit 1702 is also used to select a first function from the functions that perform first operations on multiple databases encapsulated in the first interface based on the identifier of the first database. The first function is the function that performs the first operation on the first database. The database operation unit 1703 is used to run the first function.
[0233] In some embodiments, the first interface encapsulates the function of writing data to multiple databases respectively. Before the interface calling unit 1702 calls the first interface through the first business function and passes the identifier of the first database to the first interface, it further includes: the communication unit 1704 receiving the first data of the first business object, and the multiple business objects include the first business object.
[0234] In some embodiments, when the interface calling unit 1702 passes the identifier of the first database to the first interface, it also passes the first data to the first interface; the database operation unit 1703 performs the first function including: the database operation unit 1703 writes the first data to the first database.
[0235] In some embodiments, if the first data table does not exist in the first database, the first function further includes, before running the first function, the database operation unit 1703 creating the first data table for the first database, the first data table being used to store the first data.
[0236] In some embodiments, the first interface encapsulates the function of reading data from multiple databases respectively. When the interface calling unit 1702 passes the identifier of the first database to the first interface, it also passes the first position of the second data in the first database to the first interface. The database operation unit 1703 runs the first function, including: the database operation unit 1703 reads the second data from the first database based on the first position.
[0237] In some embodiments, after the database operation unit 1703 reads the second data from the first database based on the first location, it further includes: the communication unit 1704 sending the second data to a second service object, wherein the multiple service objects include the second service object.
[0238] In some embodiments, the first interface encapsulates the function of deleting data from multiple databases respectively. When the interface calling unit 1702 passes the identifier of the first database to the first interface, it further includes: the interface calling unit 1702 passing the second position of the third data in the first database to the first interface; the database operation unit 1703 runs the first function, including: the database operation unit 1703 deleting the third data from the first database based on the second position.
[0239] In some embodiments, the first interface encapsulates the function of performing statistical analysis on multiple databases respectively. When the interface calling unit 1702 passes the identifier of the first database to the first interface, it further includes: the interface calling unit 1702 passing the third position of the fourth data in the first database and the identifier of the first statistics to the first interface; the database operation unit 1703 runs the first function, including: reading the fourth data based on the third position; and performing the first statistics on the fourth data based on the identifier of the first statistics.
[0240] In some embodiments, when the interface calling unit 1702 calls the first interface through the first business function and passes the identifier of the first database to the first interface, the interface calling unit 1702 also passes the first parameter to the first interface; the parameter bridging unit 1705 is used to determine the second parameter corresponding to the first parameter from the first mapping table according to the identifier of the first database. The first mapping table stores the original parameters corresponding to multiple input parameters of the first database. The original parameters include the first parameter and are generated by the business object.
[0241] Figure 18 This is a schematic diagram of the structure of a chip provided in an embodiment of this application. Figure 18 As shown, chip 1800 includes one or more (including two) processors 1801, bus 1802 and communication interface 1803. Optionally, chip 1800 also includes memory 1804.
[0242] In some implementations, memory 1804 stores elements such as executable modules or data structures, or subsets thereof, or extended sets thereof.
[0243] The methods described in the embodiments of this application can be applied to, or implemented by, processor 1801. Processor 1801 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 1801 or by instructions in software form. Processor 1801 may be a general-purpose processor (e.g., a microprocessor or conventional processor), a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates, transistor logic devices, or discrete hardware components. Processor 1801 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0244] The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in mature storage media in the art, such as random access memory, read-only memory, programmable read-only memory, or electrically erasable programmable read-only memory (EEPROM). This storage medium is located in memory 1804, and processor 1801 reads information from memory 1804 and, in conjunction with its hardware, completes the steps of the above method.
[0245] The processor 1801, memory 1804 and communication interface 1803 can communicate with each other via bus 1802.
[0246] In the above embodiments, the instructions stored in the memory for execution by the processor can be implemented in the form of a computer program product. This computer program product can be pre-written into the memory, or it can be downloaded and installed into the memory as software.
[0247] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. For example, available media may include magnetic media (e.g., floppy disk, hard disk, or magnetic tape), optical media (e.g., digital versatile disc (DVD)), or semiconductor media (e.g., solid-state disk (SSD)).
[0248] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program or instructions. When the computer program or instructions are executed by a processor, they implement the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0249] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disc storage; computer-readable media may include disk storage or other disk storage devices. Furthermore, any connecting cable may also be appropriately referred to as computer-readable media. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media. As used herein, disks and optical discs include optical discs (CD), laser discs, optical discs, DVDs, floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0250] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0251] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0252] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0253] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A multi-database management method, characterized in that, The method is applied to a server in a first communication system, the first communication system including the server, multiple service objects, and multiple databases. The server has one or more service functions, and the databases are used to manage the data of the multiple service objects. The method includes: The activation of a first business function is detected. The first business function includes program code that calls a first interface. The first interface encapsulates the function of performing a first operation on the multiple databases. The one or more business functions include the first business function. The first interface is invoked through the first business function, and the identifier of the first database is passed to the first interface, wherein the plurality of databases includes the first database; The first function is selected from the functions of performing the first operation on multiple databases encapsulated by the first interface based on the identifier of the first database. The first function is the function of performing the first operation on the first database. Run the first function.
2. The method according to claim 1, characterized in that, The first interface encapsulates the function of writing data to multiple databases respectively. Before calling the first interface through the first business function and passing the identifier of the first database to the first interface, the method further includes: Receive first data from a first business object, wherein the plurality of business objects include the first business object.
3. The method according to claim 2, characterized in that, When passing the identifier of the first database to the first interface, the method further includes: passing the first data to the first interface; Running the first function includes: writing the first data into the first database.
4. The method according to claim 3, characterized in that, If the first data table does not exist in the first database, the first function further includes creating the first data table for the first database before running the first function, wherein the first data table is used to store the first data.
5. The method according to claim 1, characterized in that, The first interface encapsulates the function of reading data from multiple databases respectively. When passing the identifier of the first database to the first interface, the method further includes: passing the first position of the second data in the first database to the first interface. Running the first function includes: The second data is read from the first database based on the first position.
6. The method according to claim 5, characterized in that, After reading the second data from the first database based on the first position, the method further includes: The second data is sent to a second business object, wherein the plurality of business objects include the second business object.
7. The method according to claim 1, characterized in that, The first interface encapsulates the function of deleting data from multiple databases respectively. When passing the identifier of the first database to the first interface, the method further includes: passing the second position of the third data in the first database to the first interface. Running the first function includes: The third data is deleted from the first database based on the second location.
8. The method according to claim 1, characterized in that, The first interface encapsulates the function of performing statistical analysis on data from multiple databases. When passing the identifier of the first database to the first interface, the method further includes: passing the third position of the fourth data in the first database and the identifier of the first statistics to the first interface. Running the first function includes: The fourth data is read based on the third position; The first statistic is applied to the fourth data based on the identifier of the first statistic.
9. The method according to any one of claims 1-8, characterized in that, When the method calls the first interface through the first business function and passes the identifier of the first database to the first interface, the method further includes: passing a first parameter to the first interface; The second parameter corresponding to the first parameter is determined from the first mapping table based on the identifier of the first database. The first mapping table stores the original parameters corresponding to multiple input parameters of the first database, and the original parameters include the first parameter. The original parameters are generated by the business object.
10. The method according to any one of claims 1-9, characterized in that, The multiple business objects include one or more smart home devices, and / or one or more mobile phones.
11. A server, characterized in that, The server includes a processor and a memory, wherein the memory is used to store computer programs or computer instructions, and the processor is used to execute the computer programs or computer instructions stored in the memory, causing the server to perform the method as described in any one of claims 1-10.
12. A communication system, characterized in that, The communication system includes a server, multiple business objects, and multiple databases, wherein the server is used to perform the method as described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program or computer instructions that are executed by a processor to implement the method of any one of claims 1-10.
14. A computer program product, characterized in that, When the computer program product is executed by a processor, the method described in any one of claims 1-10 will be implemented.