A method and apparatus for presenting data
By using an SQL encapsulation plugin to parse and generate SQL statements, the error problem of the BI system when processing data from different database sources was solved, enabling cross-database data display and improving user experience and applicability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JINGDONG TECH HLDG CO LTD
- Filing Date
- 2023-03-27
- Publication Date
- 2026-05-19
AI Technical Summary
Existing BI systems often encounter errors when faced with diverse data display requests that integrate databases from different sources. They are unable to effectively analyze or process data from different types of databases, resulting in narrow applicability scenarios and a poor user experience.
The SQL encapsulation plugin parses the data display request through a parameter parser, generates SQL statements using SQL design patterns, connects to different types of databases through a data source adapter, executes and processes the source data, and finally displays the target data on the front end.
It enables the rapid generation of accurate and high-quality SQL statements, can cross-integrate data from different databases, has a wide range of applications, meets the needs of any business chart display, and greatly improves the user experience.
Smart Images

Figure CN116361522B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data technology, and in particular to a method and apparatus for displaying data. Background Technology
[0002] With the widespread application of BI (Business Intelligence) visualization and analysis systems (hereinafter referred to as BI systems), it has become possible to support enterprise decision-making through data. BI systems integrate technologies such as data warehousing, reporting, and data analysis, and can integrate data from different business systems used by an enterprise to provide visualization analysis to support the enterprise's overall decision-making.
[0003] In the existing BI system, after receiving a user's data display request, the BI system will convert the data display request into a corresponding SQL statement, obtain the source data corresponding to the data display request, process it according to the requirements, and display the final processing result.
[0004] In the process of realizing this invention, the inventors discovered at least the following problems in the prior art:
[0005] Because the source databases of the data are different and the functionalities of the databases vary greatly, existing BI systems, although proficient in performing SQL statement transformations and displaying data from a single database, often encounter errors when faced with data display requests that combine diverse processing methods from source data from different databases. They are unable to analyze or process data from different types of databases in an interwoven manner, resulting in a narrow range of applicable scenarios and a poor user experience. Summary of the Invention
[0006] In view of this, embodiments of the present invention provide a data display method and apparatus that can cross-integrate source data from different databases, quickly generate corresponding SQL statements to process the source data and display the target data. The generated SQL statements are accurate, high-quality, highly reusable, and applicable to a wide range of scenarios, which can meet any business chart display needs and greatly improve the user experience.
[0007] To achieve the above objectives, according to one aspect of the present invention, a data display method is provided, the method being executed through an SQL encapsulation plugin, the method comprising:
[0008] Receive data display requests sent from the front end; wherein, the data display requests include data display formats for target data from different types of databases;
[0009] Based on the data display format of the target data, an SQL statement corresponding to the data display request is generated. The SQL statement includes the data processing method for the source data of the different types of databases. The SQL encapsulation plugin includes the mapping relationship between the functional functions of different types of databases, and the data processing method is described by the functional functions.
[0010] The system executes SQL statements corresponding to the different types of databases to obtain source data from each database, processes the source data according to the corresponding data processing method, receives target data returned by each database, and displays the target data through the front end according to the data display format.
[0011] Optionally, the SQL encapsulation plugin includes a parameter parser and an SQL design pattern. The step of generating the SQL statement corresponding to the data display request based on the data display format of the target data includes:
[0012] The parameter parser is used to parse the data display format of the target data to determine the database identifier of the source data corresponding to the target data and the data processing method of the source data;
[0013] Based on the data processing method of the source data, the SQL fragments and functional functions corresponding to the data processing method are determined through the SQL design pattern;
[0014] The database identifier of the source data, the SQL fragment corresponding to the data processing method, and the function are assembled into the SQL statement corresponding to the data display request.
[0015] Optionally, assembling the database identifier of the source data, the SQL fragment corresponding to the data processing method, and the function into the SQL statement corresponding to the data display request includes:
[0016] The SQL fragment and the database identifier of the source data are combined to generate the source data SQL statement for retrieving the source data;
[0017] By combining the SQL fragment and the function, the processing SQL statement for processing the source data is determined.
[0018] The source data SQL statement and the processing SQL statement are concatenated to obtain the SQL statement corresponding to the data display request.
[0019] Optionally, it also includes:
[0020] The SQL statement corresponding to the data display request is validated by the SQL calibration of the SQL design pattern to determine the validation result of the SQL statement corresponding to the data display request; wherein the SQL calibration uses the Apache Druid parser.
[0021] Optionally, if the validation result of the SQL statement corresponding to the data display request is successful, the method further includes:
[0022] The nested SQL statement corresponding to the data display request is split into multiple smaller SQL statements, and the split smaller SQL statements are executed asynchronously in different types of databases.
[0023] Optionally, the SQL encapsulation plugin also includes a data source adapter, which interfaces with a JDBC connection service to connect to the different types of databases.
[0024] Optionally, the different types of databases include MySQL, CK, Oracle, Doris databases, or databases that are connected to the Presto or ES query engine services.
[0025] According to another aspect of the present invention, a data display device is provided, the device including an SQL encapsulation plugin, the device comprising:
[0026] A receiving module is used to receive data display requests sent by the front end; wherein, the data display requests include data display formats for target data from different types of databases;
[0027] The statement generation module is used to generate an SQL statement corresponding to the data display request based on the data display format of the target data. The SQL statement includes the data processing method for the source data of the different types of databases. The SQL encapsulation plugin includes the mapping relationship between the function functions of different types of databases, and the data processing method is described by the function functions.
[0028] The display module is used to execute SQL statements corresponding to the different types of databases to obtain source data from each database, process the source data according to the corresponding data processing method, receive target data returned by each database, and display the target data through the front end according to the data display format.
[0029] According to another aspect of the present invention, an electronic device for displaying data is provided, comprising:
[0030] One or more processors;
[0031] Storage device for storing one or more programs.
[0032] When the one or more programs are executed by the one or more processors, the one or more processors implement the data display method provided by the present invention.
[0033] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the data display method provided by the present invention.
[0034] One embodiment of the above invention has the following advantages or beneficial effects: By using the method of parsing data display requests from web, iOS, Android, H5, and other front-ends through the parameter parser of the SQL encapsulation plugin and converting them into entities recognizable by the BI system; and by using the SQL fragments and function functions of the SQL encapsulation plugin to construct SQL statements corresponding to the data display format of the target data in the data display request, including source data SQL statements for obtaining source data and processing SQL statements for processing the source data; and by verifying through the SQL calibration of the SQL encapsulation plugin and optimizing through SQL optimization, the final SQL statement is determined and then connected to the corresponding database for execution, thereby obtaining the target data and displaying it through the front end, the technical means overcome the technical problems of existing BI systems often reporting errors when facing data display requests with diverse processing methods for source data from different source databases, being unable to interweave and analyze or process data from different types of databases, resulting in narrow application scenarios and poor user experience for the BI system, thus achieving the technical effect of being able to cross-integrate source data from different source databases, quickly generate corresponding SQL statements to process the source data and display the target data, and generate accurate, high-quality, highly reusable, and widely applicable SQL statements that can meet any business chart display needs, greatly improving the user experience.
[0035] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0036] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0037] Figure 1 This is a schematic diagram of the main flow of the data display method according to an embodiment of the present invention;
[0038] Figure 2 This is a schematic diagram of an SQL encapsulation plugin according to an embodiment of the present invention;
[0039] Figure 3This is a schematic diagram of the main flow of the SQL statement generation method according to an embodiment of the present invention;
[0040] Figure 4 This is a schematic diagram of the main modules of a data display device according to an embodiment of the present invention;
[0041] Figure 5 An exemplary system architecture diagram is shown, which is suitable for a data display method or data display device applied to embodiments of the present invention.
[0042] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0043] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0044] It should be noted that the acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0045] SQL: Structured Query Language, is a database query and programming language used to manipulate different types of data sources to write, read, query, and modify data in a database.
[0046] MySQL: A relational database management system that stores data in different tables rather than in one large repository, which can improve data processing speed and flexibility.
[0047] SQL Server is a scalable, high-performance relational database system designed for distributed client / server computing.
[0048] Oracle is a relational database management system with a distributed database as its core. It is highly portable, easy to use, and powerful, and is suitable for various large, medium, and small computer environments.
[0049] MPP stands for Massively Parallel Processing, a distributed parallel structured database cluster that distributes tasks in parallel across multiple servers and nodes, with the results from each part aggregated into the final result. Databases that adopt the MPP architecture are called MPP databases, and common examples include ClickHouse, Greenplum, and Doris.
[0050] HBase is a distributed, column-oriented, open-source database suitable for storing unstructured data.
[0051] CK: Clickhouse is a database management system that uses columnar storage.
[0052] CSV stands for Comma-Separated Values. CSV files store tabular data (numbers and text) in plain text format. A CSV file can consist of any number of records, separated by a newline character. Each record consists of fields, with other characters or strings acting as separators between fields.
[0053] API: Application Programming Interface. It provides applications and developers with the ability to access a set of routines without needing to access the source code or understand the details of the internal workings. It is a set of conventions that connect different components of a software system.
[0054] JDBC: Java Database Connectivity, is an application programming interface in the Java language used to standardize database access, providing methods for querying, writing, reading, and modifying data in a database.
[0055] Presto is an open-source, distributed SQL query engine that runs in a cluster using an MPP architecture. Designed for interactive analytical query scenarios, it can combine data sources of varying sizes for computation. As a query engine, it can connect to external data sources via connectors. It supports both non-relational and relational data sources.
[0056] ES: Elasticsearch is a highly scalable and open-source full-text search and analytics engine that can store, search, and analyze massive amounts of data in near real-time.
[0057] Doris: An interactive SQL data warehouse based on MPP architecture, primarily used for real-time reporting and multidimensional analysis.
[0058] When using an existing BI system, users can drag and drop various fields (such as item name and unit price in the sales table) according to their display needs, select the corresponding data processing method (such as sorting in descending order), and generate a data display request. The BI system will convert each field and the corresponding data processing method into the corresponding SQL statement (such as select price,name from sales order by price desc) to generate the corresponding display report for users to view.
[0059] However, due to the diverse source data and data processing methods required by users, the source data may come from different types of source databases (e.g., relational databases MySQL, SQL Server, Oracle; MPP databases Hive, CK; text files Txt, Excel, Csv, etc.). The functional differences between databases are significant, and the data processing methods may include random combinations of aggregation, sorting, filtering, etc. Existing BI systems cannot cope with the functional functions of these different databases and the random combinations of data processing methods. In other words, existing BI systems cannot handle SQL statement configuration requests for complex charts, which severely limits the application of BI systems and makes them unable to cope with analysis scenarios involving massive amounts of data.
[0060] Figure 1 This is a schematic diagram of the main flow of the data display method according to an embodiment of the present invention, such as... Figure 1 As shown, the data display method of the present invention includes the following steps:
[0061] In this embodiment of the invention, the data display method of the present invention is executed through an SQL encapsulation plugin. The SQL encapsulation plugin (or SQL assembly engine) can be introduced into the chart module of the BI system through an API interface to execute the data display method of the present invention, quickly generate SQL statements, and assist the BI system in generating various business charts.
[0062] Furthermore, the SQL encapsulation plugin can be introduced into any software system that needs to generate charts via API interface to generate SQL statements, cross-process data from different types of data sources, and display the corresponding charts. It is pluggable, reusable, easy to port, and adaptable to a wide range of application scenarios.
[0063] Step S101: Receive a data display request sent by the front end; wherein the data display request includes the data display format of target data in different types of databases.
[0064] In this embodiment of the invention, the SQL encapsulation plugin receives a data display request sent by the user through the front end. The data display request includes the target data required by the user and the data display format of the target data. For example, the data display request is a curve chart of the price of item 001 changing with inventory over the past month. The front end can be the front end of a system terminal such as iOS or Android, or it can be a front end such as Web or H5.
[0065] In this embodiment of the invention, different types of databases can be databases such as MySQL, CK, Oracle, Doris, or databases that are connected to query engine services such as Presto and ES.
[0066] Step S102: Based on the data display format of the target data, generate an SQL statement corresponding to the data display request. The SQL statement includes data processing methods for the source data of the different types of databases. The SQL encapsulation plugin includes the mapping relationship between functional functions of different types of databases, and the data processing method is described by the functional functions.
[0067] In this embodiment of the invention, the SQL encapsulation plugin of the BI system is used to analyze the target data of the data display request and the data display format of the target data, determine the database source or query engine service source of the target data, and obtain the data processing method required to manipulate the source data. Since the source data may come from different types of databases or query engine services, the SQL statement corresponding to the data display request includes function statements of different types of databases or query engine services to perform data processing on the source data and obtain the target data.
[0068] In embodiments of the present invention, such as Figure 2 As shown, the SQL encapsulation plugin includes a parameter parser, SQL design patterns, and a data source adapter. Among them:
[0069] In this embodiment of the invention, a parameter parser is used to parse the data display request and convert it into entities that the BI system can recognize, including metric fields, dimension fields, filters, etc. The data display request may include multiple fields. Numerical fields whose values can be quantified are metric fields, which can be used for aggregation, sorting, comparison, multi-angle analysis, etc., such as item unit price, item total price, item inventory, etc. Other fields whose values cannot be quantified are dimension fields, used for grouping, etc., such as recipient name, item name, etc. Filters represent filtering conditions; for example, a filter for the past month.
[0070] In this embodiment of the invention, the SQL design pattern includes SQL fragments, function blocks, SQL calibration, and SQL optimization. SQL fragments include various types such as select, from, where, order by, having, group by, and limit. Multiple SQL fragments need to be concatenated to generate the SQL statement corresponding to the data display request. Multiple SQL fragments can be nested within each other.
[0071] Functionality includes mappings between functions from various database types or query engine services. For example, the function to calculate the length of a field value might be `char_length<field_name>` in MySQL, `len<field_name>` in SQL Server, and `length<field_name>` in the Presto query engine. The mapping in the function would be: MySQL (char_length<field_name>) -> SQL Server (len<field_name>) -> Presto (length<field_name>). Functionality types are diverse, including aggregation, sorting, filtering, formatting, formulas / functions, drill-down / roll-up, cascading, jump, and transpose functions, among other higher-order functions. These can be combined with SQL fragments to generate SQL statements.
[0072] SQL calibration is used to validate the generated SQL statements. It uses the Apache Druid parser to ensure the syntactic and semantic integrity and accuracy of the SQL statements.
[0073] SQL optimization is used to fine-tune SQL statements after SQL calibration, simplify the nesting level and internal call order of SQL statements, analyze the performance of SQL statements, break down complex SQL statements into multiple shorter SQL statements, improve execution efficiency and success rate by executing multiple shorter SQL statements concurrently, prevent fault conflicts caused by complex SQL statements in the BI system that may lead to errors, and ensure the stable operation of the BI system.
[0074] The data source adapter interfaces with JDBC connection services to connect to various types of databases and query engine services such as MySQL, Presto, CK, ES, Oracle, and Doris. This allows for rapid routing and adaptation across multiple database and query engine services when executing SQL statements, accurately locating the fields or functions in the SQL statement and preventing SQL syntax differences between different database and query engine services.
[0075] In embodiments of the present invention, such as Figure 3 As shown, the SQL statement generation method of the present invention includes the following steps:
[0076] Step S301: Use a parameter parser to parse the data display format of the target data, and determine the database identifier of the source data corresponding to the target data and the data processing method of the source data.
[0077] In an embodiment of the present invention, for example, the data display request is a curve showing the price of item 001 changing with inventory over the past month. The parameter parser parses the data display request and converts it into metric fields, dimension fields, and filters that the BI system can recognize, including metric fields such as item unit price (unit is X yuan / item) and item inventory (unit is X items); dimension fields such as item name (item 001); and a filter for the past month.
[0078] Furthermore, the parameter parser determines that the target data for the data display request is the curve of the change of item unit price with item inventory, and the source data is the item unit price and item inventory; the database where the item unit price is located is the item attribute data table in the HBase database, and the database identifier is hbase; the database where the item inventory is located is the item inventory data table in the MySQL database, and the database identifier is MySQL; the data processing method of the source data includes fitting the trend curve of the change of item unit price with item inventory.
[0079] Step S302: Based on the data processing method of the source data, determine the SQL fragment and function corresponding to the data processing method through the SQL design pattern.
[0080] In this embodiment of the invention, for example, the data display request is a curve showing the price of item 001 changing with inventory over the past month. The SQL design pattern, based on the data processing method of the source data (fitting the trend curve of item unit price changing with item inventory), determines that the corresponding SQL fragments for the data processing method include `select` and `from`, and the corresponding functional functions include the `regr_intercept` and `regr_slope` functions. Specifically, the `regr_intercept` function (i.e., `regr_intercept`...)<y,x> The `regr_slope` function is used to fit a linear equation based on the input points and determine the constant term of the linear equation.<y,x> It is used to fit a linear equation based on the input points and determine the slope of the constant term of the linear equation.
[0081] Step S303: Assemble the database identifier of the source data, the SQL fragment corresponding to the data processing method, and the function into the SQL statement corresponding to the data display request.
[0082] In this embodiment of the invention, the data processing method includes acquiring source data and processing source data.
[0083] Step S3031: Combine the SQL fragment and the database identifier of the source data to generate a source data SQL statement for obtaining the source data.
[0084] In this embodiment of the invention, for example, the source SQL statement for obtaining the unit price of item 001 is selectprice,name from MySQL.sales, and the source SQL statement for obtaining the inventory of item 001 is selectstock,name from hbase.inventorys.
[0085] Step S3032: Combine the SQL fragment and the function to determine the processing SQL statement for processing the source data.
[0086] In an embodiment of the present invention, for example, the SQL statement for processing the trend curve of the unit price of item 001 as a function of the item inventory is: select regr_intercept(y,x)as inter,regr_slope(y,x)as slope from price,stock.
[0087] Step S3033: Concatenate the source data SQL statement and the processing SQL statement to obtain the SQL statement corresponding to the data display request.
[0088] In an embodiment of the present invention, for example, the source SQL statement for obtaining the unit price of item 001, the source SQL statement for obtaining the inventory of item 001, and the processing SQL statement for fitting the trend curve of the unit price of item 001 changing with the inventory are concatenated to determine the SQL statement corresponding to the data display request.
[0089] In this embodiment of the invention, the SQL statement generation method of the present invention analyzes the data display request through a parameter parser to determine the source data and data processing method of the data display request. Then, the SQL design pattern is used to generate SQL statements for obtaining source data and processing source data, which are then combined into the SQL statement for the data display request. This realizes the automation capability of the SQL encapsulation plugin to quickly generate the SQL statement corresponding to the data display request. It supports the mapping and splicing of function functions with syntactic differences from different types of data sources, and can quickly switch the SQL statement corresponding to the data source, which greatly improves the accuracy of the SQL statement. The generated SQL statement is of high quality and highly reusable.
[0090] Step S103: Execute SQL statements corresponding to the different types of databases to obtain source data from each database, process the source data according to the corresponding data processing method, receive the target data returned by each database, and display the target data through the front end according to the data display format.
[0091] In this embodiment of the invention, the SQL encapsulation plugin connects to the JDBC connection service through the data source adapter to connect to various types of database and query engine services, executes the corresponding SQL statements in the database and query engine services, thereby obtaining source data and processing the source data according to the corresponding data processing methods.
[0092] In this embodiment of the invention, the SQL encapsulation plugin receives the target data returned by various databases and query engine services and sends it to the front end, enabling the front end to display the target data.
[0093] In this embodiment of the invention, before executing the SQL statement corresponding to the different types of databases, the method further includes:
[0094] The SQL statement corresponding to the data display request is validated by the SQL calibration of the SQL design pattern to determine the validation result of the SQL statement corresponding to the data display request; wherein the SQL calibration uses the Apache Druid parser.
[0095] Furthermore, if the validation result of the SQL statement corresponding to the data display request is successful, the generated SQL statement is optimized, including splitting SQL statements with multiple nesting levels and adjusting the calling order of SQL statements with multiple calls, thereby optimizing the performance of the SQL statement. Specifically:
[0096] The nested SQL statement corresponding to the data display request is split into multiple smaller SQL statements, and these smaller SQL statements are executed asynchronously in different types of databases. For example, for nested SQL statements, while keeping the execution result unchanged, the filtering conditions of the outer select statement are moved to the inner select statement to complete data filtering in advance, reduce the amount of data processing in the outer select statement, and improve the execution speed of the SQL statement. Another example is that for nested SQL statements, if the outer select statement has few fields, redundant fields in the inner select statement are deleted to reduce redundant queries in the SQL statement.
[0097] Furthermore, executing the split, smaller SQL statements asynchronously and concurrently can ensure the stability of the BI system in handling complex data display requests.
[0098] In this embodiment of the invention, the SQL encapsulation plugin can also record the execution time of each query process and the SQL statement, thereby iteratively optimizing the SQL statement to improve the SQL statement generation efficiency and quality of the SQL encapsulation plugin.
[0099] In this embodiment of the invention, by receiving a data display request sent from the front end, wherein the data display request includes data display formats for target data from different types of databases; generating an SQL statement corresponding to the data display request based on the data display format of the target data, wherein the SQL statement includes a data processing method for the source data of the different types of databases; wherein the SQL encapsulation plugin includes a mapping relationship between functional functions of different types of databases, and the data processing method is described by the functional functions; executing the SQL statement corresponding to the database in the different types of databases to obtain source data from each database and process the source data according to the corresponding data processing method, receiving the target data returned by each database, and displaying the target data through the front end according to the data display format, etc., it is possible to cross-integrate source data from different source databases, quickly generate corresponding SQL statements to process the source data and display the target data. The generated SQL statements are accurate, high-quality, highly reusable, and widely applicable, which can meet any business chart display needs and greatly improve the user experience.
[0100] Figure 4 This is a schematic diagram of the main modules of a data display device according to an embodiment of the present invention, such as... Figure 4 As shown, the data display device 400 of the present invention includes:
[0101] The receiving module 401 is used to receive data display requests sent by the front end; wherein, the data display requests include data display formats for target data from different types of databases.
[0102] The statement generation module 402 is used to generate an SQL statement corresponding to the data display request based on the data display format of the target data. The SQL statement includes the data processing method for the source data of the different types of databases. The SQL encapsulation plugin includes the mapping relationship between the function functions of different types of databases, and the data processing method is described by the function functions.
[0103] The display module 403 is used to execute SQL statements corresponding to the different types of databases to obtain source data from each database, process the source data according to the corresponding data processing method, receive target data returned by each database, and display the target data through the front end according to the data display format.
[0104] In this embodiment of the invention, through modules such as the receiving module, the statement generation module, and the display module, source data from different source databases can be cross-integrated to quickly generate corresponding SQL statements to process the source data and display the target data. The generated SQL statements are accurate, high-quality, highly reusable, and applicable to a wide range of scenarios, which can meet any business chart display needs and greatly improve the user experience.
[0105] Figure 5 An exemplary system architecture diagram is shown, which is suitable for data display methods or data display devices applied to embodiments of the present invention, such as... Figure 5 As shown, the exemplary system architecture of the data display method or data display device according to embodiments of the present invention includes:
[0106] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, and 503, network 504, and server 505. Network 504 is used as a medium to provide a communication link between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0107] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as chart applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0108] Terminal devices 501, 502, and 503 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0109] Server 505 can be a server that provides various services, such as a backend management server that supports chart-based websites browsed by users using terminal devices 501, 502, and 503. The backend management server can analyze and process received data display requests and other data, and feed back the processing results (such as target data) to terminal devices 501, 502, and 503.
[0110] It should be noted that the data display method provided in the embodiments of the present invention is generally executed by the server 505, and correspondingly, the data display device is generally set in the server 505.
[0111] It should be understood that Figure 5The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0112] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention, such as... Figure 6 As shown, the computer system 600 of the terminal device or server in this embodiment of the invention includes:
[0113] The central processing unit (CPU) 601 can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of system 600. CPU 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0114] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0115] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.
[0116] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0118] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a receiving module, a statement generation module, and a display module. The names of these modules do not necessarily limit the module itself; for example, the statement generation module can also be described as "a module that generates SQL statements corresponding to the data display request based on the data display format of the target data."
[0119] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: receiving a data display request sent by a front end; wherein the data display request includes a data display format for target data in different types of databases; generating an SQL statement corresponding to the data display request based on the data display format of the target data, the SQL statement including a data processing method for the source data in the different types of databases; wherein the SQL encapsulation plugin includes a mapping relationship between functional functions of different types of databases, the data processing method being described by the functional functions; executing the SQL statement corresponding to the different types of databases to obtain source data from each database and process the source data according to the corresponding data processing method; receiving target data returned by each database; and displaying the target data through the front end according to the data display format.
[0120] According to the technical solution of this invention, the high-performance syntax retrieval and routing adaptation of the SQL encapsulation plugin support the rapid location and switching of functions with syntactic differences in different types of data sources. The SaaS (Software-as-a-Service) model of the SQL encapsulation plugin allows it to be used in any scenario involving SQL statement concatenation and generation, offering high openness and versatility. It meets the SQL statement determination requests of diverse chart generation scenarios (nearly 30,000 types), and the various parts of the SQL encapsulation plugin are seamlessly connected, thereby generating query SQL quickly and accurately. It is also applicable to any product field with SQL statement generation needs, and is suitable for various other product areas besides BI that require SQL.
[0121] According to the technical solution of the present invention, through high abstraction, automated assembly is applied to SQL statement generation scenarios, which expands the service goals of various scenarios and achieves plug-and-play functionality. Users do not need to understand SQL principles; they only need to install an SQL encapsulation plugin in the system. The SQL encapsulation plugin can convert the data display requests of the system front end into executable SQL statements, which are compatible with the syntax rules of multiple databases or query engine services and have the advantages of high availability, high scalability, and high performance.
[0122] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for displaying data, characterized in that, The method is executed through an SQL encapsulation plugin, and the method includes: Receive data display requests sent from the front end; wherein, the data display requests include data display formats for target data from different types of databases; Based on the data display format of the target data, an SQL statement corresponding to the data display request is generated. The SQL statement includes the data processing method for the source data of the different types of databases. The SQL encapsulation plugin includes the mapping relationship between the functional functions of different types of databases, and the data processing method is described by the functional functions. The system executes SQL statements corresponding to the different types of databases to obtain source data from each database, processes the source data according to the corresponding data processing method, receives target data returned by each database, and displays the target data through the front end according to the data display format. The SQL encapsulation plugin includes a parameter parser and an SQL design pattern. The parameter parser is used to parse data display requests and convert them into entities that the business intelligence system can recognize. The step of generating an SQL statement corresponding to the data display request based on the data display format of the target data includes: The parameter parser is used to parse the data display format of the target data to determine the database identifier of the source data corresponding to the target data and the data processing method of the source data; Based on the data processing method of the source data, the SQL fragments and functional functions corresponding to the data processing method are determined through the SQL design pattern; The database identifier of the source data, the SQL fragment corresponding to the data processing method, and the function are assembled into the SQL statement corresponding to the data display request. The method further includes: verifying the SQL statement corresponding to the data display request through the SQL calibration of the SQL design pattern, and determining the verification result of the SQL statement corresponding to the data display request; If the verification result of the SQL statement corresponding to the data display request is successful, the method further includes: splitting the nested SQL statement corresponding to the data display request into multiple smaller SQL statements, and asynchronously executing the split smaller SQL statements in different types of databases.
2. The method according to claim 1, characterized in that, The step of assembling the database identifier of the source data, the SQL fragment corresponding to the data processing method, and the function into the SQL statement corresponding to the data display request includes: The SQL fragment and the database identifier of the source data are combined to generate the source data SQL statement for retrieving the source data; By combining the SQL fragment and the function, the processing SQL statement for processing the source data is determined. The source data SQL statement and the processing SQL statement are concatenated to obtain the SQL statement corresponding to the data display request.
3. The method according to claim 1 or 2, characterized in that, Also includes: The SQL calibration uses the Apache Druid parser.
4. The method according to claim 1, characterized in that, The SQL encapsulation plugin also includes a data source adapter, which interfaces with a JDBC connection service to connect to the different types of databases.
5. The method according to claim 4, characterized in that, The different types of databases include MySQL, CK, Oracle, Doris databases, or databases that are integrated with Presto or ES query engine services.
6. A data display device, characterized in that, The device includes an SQL encapsulation plugin, and the device includes: A receiving module is used to receive data display requests sent by the front end; wherein, the data display requests include data display formats for target data from different types of databases; The statement generation module is used to generate an SQL statement corresponding to the data display request based on the data display format of the target data. The SQL statement includes the data processing method for the source data of the different types of databases. The SQL encapsulation plugin includes the mapping relationship between the function functions of different types of databases, and the data processing method is described by the function functions. The display module is used to execute SQL statements corresponding to the different types of databases to obtain source data from each database, process the source data according to the corresponding data processing method, receive target data returned by each database, and display the target data through the front end according to the data display format. The SQL encapsulation plugin includes a parameter parser and an SQL design pattern. The parameter parser is used to parse data display requests and convert them into entities that the business intelligence system can recognize. The step of generating an SQL statement corresponding to the data display request based on the data display format of the target data includes: The parameter parser is used to parse the data display format of the target data to determine the database identifier of the source data corresponding to the target data and the data processing method of the source data; Based on the data processing method of the source data, the SQL fragments and functional functions corresponding to the data processing method are determined through the SQL design pattern; The database identifier of the source data, the SQL fragment corresponding to the data processing method, and the function are assembled into the SQL statement corresponding to the data display request. The display module is also used to verify the SQL statement corresponding to the data display request through the SQL calibration of the SQL design pattern, and determine the verification result of the SQL statement corresponding to the data display request. If the verification result of the SQL statement corresponding to the data display request is successful, the display module is also used to split the nested SQL statement corresponding to the data display request into multiple smaller SQL statements, and execute the split smaller SQL statements asynchronously in different types of databases.
7. An electronic device for displaying data, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.