Data processing method and apparatus
By obtaining the user-selected metrics and their associated table information, a query language with placeholders is generated and populated. This solves the problems of high writing difficulty and low efficiency caused by the uncertainty of user information location, and realizes convenient and efficient query language generation and metric data acquisition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI TAIMEI DIGITAL TECH CO LTD
- Filing Date
- 2023-04-04
- Publication Date
- 2026-06-19
AI Technical Summary
When writing structured query languages, the uncertainty of the location of user information makes writing query languages difficult and inefficient, requiring manual intervention for maintenance.
By obtaining the metrics selected by the user and their associated table information, a query language including placeholders is generated. Then, the placeholders are filled with user identification information to generate a second query language to obtain the metric data.
It improves the ease and efficiency of writing query languages, ensuring that different users obtain different indicator data using the same indicator.
Smart Images

Figure CN116521704B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a data processing method and apparatus. Background Technology
[0002] Structured Query Language (SQL) is a database query and programming language. However, in the process of writing SQL, to obtain query results for a user, user information is usually incorporated into the SQL. But because the location of user information when it is added to the SQL is uncertain—that is, it is unclear where the user's information will be added in the query language—manual intervention is usually required for maintenance and arrangement, resulting in greater difficulty and lower efficiency in generating SQL. Summary of the Invention
[0003] In view of this, embodiments of this application provide a data processing method and apparatus that can acquire user-specific indicator data while improving the ease of writing query languages.
[0004] In a first aspect, embodiments of this application provide a data processing method, the method comprising: acquiring N indicators based on a user's selection operation on a user interface, wherein each of the N indicators includes metadata, the metadata includes table information, and N is a positive integer greater than or equal to 1; when it is detected that the table information of M indicators among the N indicators respectively has corresponding associated table information, acquiring M associated table information, wherein the associated table information is table information with placeholders, the M associated table information includes M placeholders, and M is a positive integer greater than or equal to 1 and less than or equal to N; generating a first query language based on the metadata of the N indicators and the M associated table information, wherein the first query language includes M placeholders; filling the M placeholders in the first query language with the user's identification information to obtain a second query language, so that the user can obtain indicator data for the N indicators based on the second query language.
[0005] In some embodiments of this application, when N is greater than or equal to 2, the N indicators include multiple indicators, and the M related table information is J related table information, where J is a positive integer greater than or equal to 2 and less than N. The generation of a first query language based on the metadata of the N indicators and the M related table information includes: obtaining the association relationships between the table information of the multiple indicators; generating a third query language based on the metadata and association relationships of the multiple indicators, wherein the third query language includes the table information of the J indicators; and replacing the table information of the J indicators in the third query language with the J related table information to generate the first query language.
[0006] In some embodiments of this application, when N equals 1, the N indicators include a single indicator, and the M related table information includes a single related table information. The generation of a first query language based on the metadata of the N indicators and the M related table information includes: obtaining a fourth query language based on the metadata of a single indicator, wherein the fourth query language includes the table information of the single indicator; and replacing the table information of the single indicator in the fourth query language with the single related table information to generate the first query language.
[0007] In some embodiments of this application, filling M placeholders in a first query language with user identification information to obtain a second query language includes: determining the position information of the M placeholders in the first query language; and filling the identification information into the position information of the M placeholders respectively to obtain the second query language.
[0008] In some embodiments of this application, when it is detected that the table information of M indicators out of N indicators has corresponding associated table information, obtaining the M associated table information includes: when it is detected that M indicators have a specified identifier, obtaining the M associated table information corresponding to the M indicators.
[0009] In some embodiments of this application, after filling M placeholders in the first query language with the user's identification information to obtain the second query language, the method further includes: using the second query language to obtain N metrics data for the user from the database.
[0010] In some embodiments of this application, the first query language includes SQL, and the second query language includes SQL.
[0011] Secondly, embodiments of this application provide a data processing apparatus, comprising: a first acquisition module, configured to acquire N indicators based on a user's selection operation on a user interface, wherein each of the N indicators includes metadata, the metadata includes table information, and N is a positive integer greater than or equal to 1; a second acquisition module, configured to acquire M related table information when it is detected that the table information of M indicators among the N indicators respectively has corresponding related table information, wherein the related table information is table information with placeholders, the M related table information includes M placeholders, and M is a positive integer greater than or equal to 1 and less than or equal to N; a generation module, configured to generate a first query language based on the metadata of the N indicators and the M related table information, wherein the first query language includes M placeholders; and a filling acquisition module, configured to fill the M placeholders in the first query language with the user's identification information to obtain a second query language, so that the user can obtain indicator data for the N indicators based on the second query language.
[0012] Thirdly, embodiments of this application provide a computationally readable storage medium storing a computer program for executing the data processing method described in the first aspect.
[0013] Fourthly, embodiments of this application provide an electronic device, including: a processor; and a memory for storing processor-executable instructions, wherein the processor is used to execute the data processing method described in the first aspect above.
[0014] This application provides a data processing method and apparatus. By acquiring N indicators selected by a user and determining M related table information, including placeholders, for M indicators among the N indicators, a first query language including M placeholders is generated based on the metadata of the N indicators and the M related table information. Then, the user's identification information is filled into the M placeholders in the first query language to obtain a second query language for querying the indicator data corresponding to the user. This method can clarify the filling position of the identification information by using placeholders, improve the convenience of writing the query language, and also achieve the goal of different users obtaining different indicator data using the same indicator. Attached Figure Description
[0015] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:
[0016] Figure 1 This is a flowchart illustrating a data processing method provided in an exemplary embodiment of this application.
[0017] Figure 2 This is a schematic diagram of a user interface provided in an exemplary embodiment of this application.
[0018] Figure 3 This is a flowchart illustrating a data processing method provided in another exemplary embodiment of this application.
[0019] Figure 4 This is a schematic diagram of the process for obtaining a second query language provided in an exemplary embodiment of this application.
[0020] Figure 5 This is a schematic diagram of the structure of a data processing apparatus provided in an exemplary embodiment of this application.
[0021] Figure 6 This is a block diagram of an electronic device for data processing provided in an exemplary embodiment of this application. Detailed Implementation
[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] Application Overview
[0024] Users can combine multiple different metrics according to their needs (e.g., construct a metric set). After the user completes the combination of multiple different metrics, the reporting system can convert the combined metrics into a query language (e.g., SQL). Finally, the reporting system can use this query language to retrieve the corresponding metric data from the database, so that users can perform data analysis on the metric data. When different users use the same metric, the metric value obtained should be the result of calculation combined with the current user's own information (i.e., user identification information), meaning that different users will obtain different metric data.
[0025] However, when adding user identification information to the query language in the current reporting system, the location of the added identification information is uncertain, so manual access and maintenance are usually required. This leads to problems such as low efficiency and poor adaptability in writing query languages for users.
[0026] To address the aforementioned problems, this application provides a data processing method. Various non-limiting embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0027] Exemplary methods
[0028] Figure 1 This is a flowchart illustrating a data processing method provided in an exemplary embodiment of this application. Figure 1 The method is executed by computing devices, such as servers or reporting systems running on servers (also known as "custom reporting systems"). For example... Figure 1 As shown, the data processing method includes the following:
[0029] S110: Obtain N metrics based on the user's selections on the user interface.
[0030] In one embodiment, each of the N metrics includes metadata, which includes table information, where N is a positive integer greater than or equal to 1.
[0031] Specifically, metrics can include metadata, functions, and metric names. Metadata can include table information (e.g., table name), database information (e.g., database name), and column information (e.g., column names). For example, the metadata for a metric might be table t_01 and column idx_01, where t_01 is the table name and idx_01 is the column name. Functions can be summation functions (e.g., SUM function), average functions (e.g., AVG function), and counting functions (e.g., COUNT function), etc. In other words, metrics can be generated from metadata and functions through certain arrangement and calculations. Furthermore, metrics can be parameters used to measure objectives in a business scenario. For example, a metric could be a student's academic performance used to evaluate their learning.
[0032] In one embodiment, the reporting system can receive a user's selection operation instruction to click and drag N indicators to a specified area (i.e., a specified analysis area) on the user interface to obtain N indicators, where N can be one or more. This application embodiment does not specifically limit the number of indicators.
[0033] See Figure 2 The user interface 200 can display a designated analysis area 201, indicator 1202, and indicator 2203. Users can click and drag N indicators to the designated analysis area 201 to select N indicators. For example, a user can click and drag indicator 1202 to the designated analysis area 101, where N is 1. Alternatively, a user can first click and drag indicator 1202 to the designated analysis area 201, and then click and drag indicator 2203 to the designated analysis area 201, where N is 2. This application does not specify a particular number of indicators.
[0034] It should be noted that when dragging N indicators (where N is greater than or equal to 2), the N indicators can be arranged, that is, the order in which the N indicators are placed can be arranged. This application does not specifically limit the arrangement method in the embodiments.
[0035] In one embodiment, the N indicators can be presented on the user interface in the form of an indicator tree, which can be understood as a tree structure composed of the N indicators. For example, see... Figure 2 The indicator tree (i.e., Tree) displayed on the right side of the user interface 200 can be iTameiEdc_003, which can be the root node, Study, Site, or Subject, which can be child nodes, and Indicator 1 and Indicator 2 can be leaf nodes.
[0036] In one embodiment, before obtaining N metrics based on the user's selection on the user interface, the process may further include: receiving a generation request sent by the user, wherein the generation request indicates the generation of R metrics, which include N metrics, and R is a positive integer greater than or equal to N. The reporting system can then determine the business scenario corresponding to the user information, and further determine the business template corresponding to the business scenario. The business template can be pre-constructed using metadata of the same business scenario, and the business template can include R metrics (i.e., the metadata, function, and metric name of each of the R metrics). The reporting system can then generate R metrics at once based on the business template to avoid the inefficiency of generating metrics one by one.
[0037] S120: If the table information of M out of N indicators has corresponding related table information, obtain the M related table information.
[0038] In one embodiment, the association table information is table information with placeholders, and the M association table information includes M placeholders, where M is a positive integer greater than or equal to 1 and less than or equal to N.
[0039] Specifically, the reporting system can detect N indicators and determine whether any of the N indicators have corresponding related table information. If it detects that M indicators out of the N indicators have corresponding related table information, the reporting system can obtain the M related table information corresponding to the M indicators.
[0040] In one embodiment, the association table information may include placeholders, and there is a one-to-one correspondence between the association table information and the placeholders. It should be noted that when the placeholders are represented in code form, they can use the symbol $, that is, the content between two $ symbols is the content that the user's identification information needs to be filled in, for example, $tenatld$.
[0041] In one embodiment, determining whether the table information of an indicator has corresponding related table information may include: first, setting a specified identifier for indicators that have a corresponding relationship with related table information, wherein the specified identifier is used to indicate that the table information of the indicator has corresponding related table information; then, the reporting system can obtain the related table information corresponding to the table information of the indicator when it detects that the indicator carries the specified identifier.
[0042] S130: Generate the first query language based on metadata of N indicators and information from M related tables.
[0043] In one embodiment, the first query language includes M placeholders, and the first query language includes the SQL language.
[0044] Specifically, when N is 1, the metric is a single metric, and M is also 1, meaning that M related table information is a single related table information. In this case, the reporting system can obtain a fourth query language based on the metadata of a single metric, where the fourth query language can include the table information of the single metric. The reporting system can then replace the table information of the single metric in the fourth query language with the single related table information to obtain a first query language with a single placeholder.
[0045] In one embodiment, when N is greater than 1 (or greater than or equal to 2), there are multiple metrics, M related table information, and J related table information, where J is a positive integer greater than or equal to 2 and less than N. In this case, the reporting system can obtain the relationships between the metadata of the multiple metrics, where the relationships can be Entity Relationship Diagram (ER) relationships between the table information of the multiple metrics. Then, the reporting system can generate a third query language based on the metadata and relationships of the multiple metrics, where the third query language can include the J table information corresponding to the J related table information. Furthermore, the reporting system can replace the table information of the J metrics in the third query language with the J related table information to generate a first query language with J placeholders.
[0046] S140: Fill the M placeholders in the first query language with the user's identification information to obtain the second query language, so that the user can obtain the indicator data of N indicators for the user based on the second query language.
[0047] In one embodiment, the second query language includes the SQL language.
[0048] Specifically, the user's identification information can be the user's unique identifier, the user's item's unique identifier, or the user's name identifier; this application embodiment does not impose specific limitations on this. It should be noted that the user's identification information can also be called the user's domain information, used to represent the user's basic information, where different domain information corresponds to different indicator data.
[0049] The first query language can include M placeholders. The reporting system can first determine the position information of the M placeholders, and then fill the position information of the M placeholders in the first query language with the user's identification information to obtain the second query language.
[0050] In one embodiment, after obtaining the second query language, the method may further include: using the second query language to obtain indicator data for N indicators of the user from a database, wherein the database may be a relational database.
[0051] It's important to note that a reporting system can be understood as a tool suitable for analyzing relational database data. A reporting system allows users to generate metrics, write query languages (i.e., SQL statements), and execute these queries to retrieve metric data. Furthermore, the reporting system can use the obtained metric data as the foundation for creating reports.
[0052] Therefore, this application embodiment obtains N indicators selected by the user, and determines M related table information including placeholders for M indicators among the N indicators. Based on the metadata of the N indicators and the M related table information, a first query language including M placeholders is generated. Then, the user's identification information is filled into the M placeholders in the first query language to obtain a second query language for querying the indicator data corresponding to the user. This can clarify the filling position of the identification information by using placeholders, improve the convenience of writing the query language, and also achieve the purpose of different users using the same indicator to obtain different indicator data.
[0053] Figure 3 This is a flowchart illustrating a data processing method provided in another exemplary embodiment of this application. Figure 3 The example is Figure 1 Further limitations on step S130 in the embodiments. For example... Figure 3 As shown, step S130 further includes the following:
[0054] In one embodiment, when N is greater than or equal to 2, the N indicators include multiple indicators, the M association table information is J association table information, and J is a positive integer greater than or equal to 2 and less than N.
[0055] S310: Obtain the relationships between table information of multiple indicators.
[0056] Specifically, multiple indicators can be constructed into an indicator set, where the number of indicators included in the indicator set can be 3, 4, or 5; this application embodiment does not specifically limit this. For example, see... Figure 4 The indicator set 401 can include four indicators: indicator 1410, indicator 2420, indicator 3430, and indicator 4440.
[0057] The metadata for each of the multiple metrics can include information such as table name, column names, and database name. For example, see... Figure 4The metadata 1411 corresponding to metric 1410 includes table: t_01, column: idx_01; the metadata corresponding to metrics 2420 and 3430 includes table: v_02, column 1: idx_02, column 2: idx_03; and the metadata corresponding to metric 4440 includes table: v_03, column: idx_04. It should be noted that the database name is an attribute of the table name, meaning the table name indicates which database the table belongs to. Column names are usually appended to the table name to indicate which column within the table. In other words, determining the relationships between table names clarifies the relationships between database names and column names.
[0058] Relationships can refer to the ER (Enterprise Relationship) between table information, that is, the connection relationship between table information corresponding to multiple indicators. For example, see... Figure 4 ER relation 402, inner is used to represent the relationship between metadata 1411 and metadata 2421, and left is used to represent the relationship between metadata 1411 and metadata 3441.
[0059] S320: Generates a third query language based on the metadata and relationships of multiple metrics.
[0060] In one embodiment, the third query language includes table information for J indicators, and the third query language can be SQL.
[0061] Specifically, when the reporting system detects that J indicators among multiple metrics have related table information, it retrieves the information from those J related tables. For example, see... Figure 4 The metadata table information for metric 4440 is v_03, and the associated table information for this table is associated table information 2442 in associated table information list 403. The metadata table information for metric 3430 is v_02, and the associated table information for this table is associated table information 1422. The table information for metric 2420 is the same as that for metric 3430, v_02, and the associated table information is associated table information 1422.
[0062] Furthermore, the reporting system can construct a third query language based on the metadata of multiple indicators and the relationships between the metadata corresponding to the multiple indicators. The third query language includes table information that corresponds to the information in the associated tables.
[0063] S330: Replace the table information of J indicators in the third query language with the information of J related tables to generate the first query language.
[0064] Specifically, the reporting system replaces the table information of J indicators in the third query language with information from J related tables to obtain the first query language, for example, Figure 4The first query language in the query is 450, which includes two placeholders.
[0065] Therefore, this application embodiment obtains a third query language based on the metadata of multiple indicators, and then uses the association table information to replace the table information of the indicators in the third query language, so that the reporting system obtains a first query language with placeholders, laying the foundation for subsequently using the user's identification information to dynamically fill the placeholders, thereby obtaining a query language for the user.
[0066] In one embodiment of this application, when N equals 1, the N indicators include a single indicator, and the M related table information includes a single related table information. The generation of a first query language based on the metadata of the N indicators and the M related table information includes: obtaining a fourth query language based on the metadata of a single indicator, wherein the fourth query language includes the table information of the single indicator; and replacing the table information of the single indicator in the fourth query language with the single related table information to generate the first query language.
[0067] In one embodiment, the fourth query language is SQL.
[0068] Specifically, when the number of indicators is single, the number of related table information is also single in order to provide placeholders for the first query language.
[0069] The reporting system can obtain a fourth query language based on the table and column information of a single indicator. The table information of this single indicator contains a corresponding single related table with placeholders, which can be pre-stored in the reporting system. The reporting system can then replace the table information of the single indicator in the fourth query language with the single related table information to obtain a first query language, which includes placeholders.
[0070] Therefore, it can be seen that the embodiments of this application obtain a fourth query language based on the metadata of a single indicator, and then use the association table information to replace the table information of the indicator in the fourth query language, so that the reporting system obtains a first query language with placeholders, which lays the foundation for subsequently using the user's identification information to fill the placeholders and thus obtain a query language for the user.
[0071] In one embodiment of this application, filling M placeholders in a first query language with user identification information to obtain a second query language includes: determining the position information of the M placeholders in the first query language; and filling the identification information into the position information of the M placeholders respectively to obtain the second query language.
[0072] Specifically, the reporting system can first determine the position information of M placeholders in the first query language, that is, determine the position of the M placeholders in the first query language. Then, the user's identification information is dynamically filled into the position information of the M placeholders respectively, that is, the identification information is replaced with the M placeholders respectively to obtain the second query language.
[0073] For example, see Figure 4 The user's identification information 460 is dynamically filled into the position information of M placeholders in the first query language to obtain the second query language 470.
[0074] Therefore, this application embodiment provides a guarantee for users to obtain their corresponding indicator data by using the user's identification information to fill in placeholders.
[0075] In one embodiment of this application, when it is detected that the table information of M indicators out of N indicators has corresponding associated table information, obtaining the M associated table information includes: when it is detected that the M indicators have a specified identifier, obtaining the M associated table information corresponding to the M indicators.
[0076] Specifically, when a metric's table information has corresponding related table information, a designated identifier can be pre-set for the metric. This identifier indicates that the metric's table information has corresponding related table information. When the reporting system detects that M out of N metrics carry the designated identifier, the reporting system can determine that the table information of each of the M metrics has corresponding related table information. The reporting system can then obtain the M related table information, where M can be a positive integer greater than or equal to 1 and less than or equal to N.
[0077] For example, if the reporting system detects that 15 out of 20 indicators carry a specified identifier, the reporting system can obtain the information of 15 related tables corresponding to the 15 indicators, where the number of N is 20 and the number of M is 15.
[0078] Therefore, this application embodiment enables the reporting system to quickly identify indicators that correspond to information in the associated table by pre-setting specified identifiers for the indicators, thereby improving the speed of obtaining information in the associated table and further improving the efficiency of obtaining query language.
[0079] In one embodiment of this application, after filling M placeholders in the first query language with the user's identification information to obtain the second query language, the method further includes: using the second query language to obtain N indicator data for the user from the database.
[0080] Specifically, the reporting system can use a second query language to retrieve indicator data corresponding to N indicators for a user from the database. The database can be a relational database, such as a MySQL (My Structured Query Language) database or an Oracle database, and the indicator data can be presented as a dataset.
[0081] In one embodiment, the reporting system can use a second query language to retrieve initial indicator data from a database. This initial indicator data may include data to be processed (e.g., Chinese-English conversion or font adjustment). Then, the reporting system can iterate through each row of the initial indicator data to determine the data to be processed. Using this data as a parameter, the system remotely invokes a dictionary in the business system to process the data to be processed, thereby obtaining the processed data. The business system is a system within a business scenario, and the reporting system can be integrated into the business system. Finally, the reporting system can replace the data to be processed in the initial indicator data with the processed data to obtain the final indicator data.
[0082] Therefore, this application embodiment provides a guarantee for users to obtain indicator data based on query language by using query language to retrieve indicator data from the database. At the same time, by remotely calling the dictionary in the business system, it avoids the problem of storing the dictionary in the reporting system and consuming resources, and also avoids the problem of needing to adjust and maintain the dictionary in the business system in a timely manner as business scenarios change, thereby improving the adaptability of the reporting system and the flexibility of application.
[0083] Exemplary device
[0084] Figure 5 This is a schematic diagram of the structure of a data processing apparatus 500 provided in an exemplary embodiment of this application. Figure 5 As shown, the data processing device 500 includes: a first acquisition module 510, a second acquisition module 520, a generation module 530, and a filling acquisition module 540.
[0085] The first acquisition module 510 is used to acquire N indicators based on the user's selection operation on the user interface, wherein each of the N indicators includes metadata, the metadata includes table information, and N is a positive integer greater than or equal to 1; the second acquisition module 520 is used to acquire M related table information when it is detected that the table information of M indicators among the N indicators has corresponding related table information, wherein the related table information is table information with placeholders, the M related table information includes M placeholders, and M is a positive integer greater than or equal to 1 and less than or equal to N; the generation module 530 is used to generate a first query language based on the metadata of the N indicators and the M related table information, wherein the first query language includes M placeholders; the filling acquisition module 540 is used to fill the M placeholders in the first query language with the user's identification information to obtain a second query language, so that the user can obtain indicator data for the user's N indicators based on the second query language.
[0086] This application provides a data processing device that acquires N indicators selected by a user and determines M related table information, including placeholders, for M indicators among the N indicators. Based on the metadata of the N indicators and the M related table information, a first query language including M placeholders is generated. Then, the user's identification information is filled into the M placeholders in the first query language to obtain a second query language for querying the indicator data corresponding to the user. This allows the placement of identification information to be clearly defined by using placeholders, improving the convenience of writing the query language. At the same time, it also achieves the goal of different users obtaining different indicator data using the same indicator.
[0087] According to one embodiment of this application, when N is greater than or equal to 2, the N indicators include multiple indicators, the M related table information is J related table information, and J is a positive integer greater than or equal to 2 and less than N. The generation module 530 is used to obtain the association relationship between the table information of multiple indicators; generate a third query language based on the metadata and association relationship of multiple indicators, wherein the third query language includes the table information of J indicators; replace the table information of J indicators in the third query language with the J related table information to generate a first query language.
[0088] According to one embodiment of this application, when N equals 1, N indicators include a single indicator, and M related table information includes a single related table information. The generation module 530 is used to obtain a fourth query language based on the metadata of a single indicator, wherein the fourth query language includes the table information of the single indicator; and replace the table information of the single indicator in the fourth query language with the single related table information to generate a first query language.
[0089] According to one embodiment of this application, the filling acquisition module 540 is used to determine the position information of M placeholders in the first query language; and fill the identification information into the position information of the M placeholders respectively to obtain the second query language.
[0090] According to one embodiment of this application, the second acquisition module 520 is used to acquire M related table information corresponding to M indicators when M indicators are detected to have specified identifiers.
[0091] According to one embodiment of this application, the filling acquisition module 540 is further configured to use a second query language to obtain indicator data for N indicators for the user from the database.
[0092] According to one embodiment of this application, the first query language includes SQL language, and the second query language includes SQL language.
[0093] It should be understood that the specific working process and functions of the first acquisition module 510, the second acquisition module 520, the generation module 530, and the filling acquisition module 540 in the above embodiments can be referred to the above. Figures 1 to 4 The description of the data processing method provided in the embodiments will not be repeated here to avoid repetition.
[0094] Exemplary electronic devices and computer-readable storage media
[0095] Figure 6 This is a block diagram of an electronic device 600 for data processing provided in an exemplary embodiment of this application.
[0096] Reference Figure 6 The electronic device 600 includes a processing component 610, which further includes one or more processors, and memory resources represented by memory 620 for storing instructions, such as application programs, that can be executed by the processing component 610. The application programs stored in memory 620 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 610 is configured to execute instructions to perform the aforementioned data processing methods.
[0097] Electronic device 600 may also include a power supply component configured to perform power management of electronic device 600, a wired or wireless network interface configured to connect electronic device 600 to a network, and an input / output (I / O) interface. Electronic device 600 can be operated based on an operating system stored in memory 620, such as Windows Server. TM Mac OSX TM Unix TM Linux TM FreeBSD TM Or similar.
[0098] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of the aforementioned electronic device 600, enables the electronic device 600 to perform a data processing method, comprising: acquiring N indicators based on a user's selection operation on a user interface, wherein each of the N indicators includes metadata, the metadata including table information, and N being a positive integer greater than or equal to 1; acquiring M related table information when it is detected that the table information of M of the N indicators respectively has corresponding related table information, wherein the related table information is table information with placeholders, the M related table information including M placeholders, and M being a positive integer greater than or equal to 1 and less than or equal to N; generating a first query language based on the metadata of the N indicators and the M related table information, wherein the first query language includes M placeholders; and filling the M placeholders in the first query language with the user's identification information to obtain a second query language, so that the user can obtain indicator data for the N indicators based on the second query language.
[0099] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.
[0100] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0101] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0102] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0103] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0104] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0105] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program verification codes, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0106] It should be noted that in the description of this application, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0107] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications or equivalent substitutions made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A data processing method, characterized by, include: N metrics are obtained based on the user's selection on the user interface, wherein each of the N metrics includes metadata, the metadata includes table information, and N is a positive integer greater than or equal to 1; If it is detected that the table information of M indicators out of the N indicators has corresponding related table information, then M related table information is obtained, wherein the related table information is table information with placeholders, and the M related table information includes M placeholders, where M is a positive integer greater than or equal to 1 and less than or equal to N. Based on the metadata of the N indicators and the M related table information, the table information of the metadata is replaced by the M related table information to generate a first query language, wherein the first query language includes the M placeholders; Determine the position information of the M placeholders in the first query language, and fill the user's identification information into the position information of the M placeholders respectively to obtain the second query language, so that the user can obtain the indicator data of the N indicators for the user based on the second query language.
2. The method of claim 1, wherein, When N is greater than 2, the N indicators include multiple indicators, and the M related table information consists of J related table information, where J is a positive integer greater than 2 and less than N. The step of replacing the table information of the metadata with the table information of the M related tables based on the metadata of the N indicators and the M related table information to generate a first query language includes: Obtain the relationships between the table information of the multiple indicators; A third query language is generated based on the metadata of the multiple indicators and the relationships between them, wherein the third query language includes table information of J indicators; The table information of the J indicators in the third query language is replaced with the table information of the J related tables to generate the first query language.
3. The method of claim 1, wherein, When N equals 1, the N indicators include a single indicator, and the M related table information includes a single related table information. The step of replacing the table information of the metadata with the table information of the M related tables based on the metadata of the N indicators and the M related table information to generate a first query language includes: Based on the metadata of the single indicator, a fourth query language is obtained, wherein the fourth query language includes the table information of the single indicator; The first query language is generated by replacing the table information of the single indicator in the fourth query language with the information of the single related table.
4. The method of claim 1, wherein, The step of obtaining M related table information when it is detected that the table information of M indicators out of the N indicators has corresponding related table information includes: If the M indicators are detected to have a specified identifier, obtain the M related table information corresponding to the M indicators.
5. The method of claim 1, wherein, After determining the position information of the M placeholders in the first query language and filling in the user's identification information at the positions of the M placeholders to obtain the second query language, the process further includes: The second query language is used to retrieve the N metrics data for the user from the database.
6. The method according to any one of claims 1 to 5, characterized in that, The first query language includes SQL, and the second query language includes SQL.
7. A data processing apparatus, characterized by include: The first acquisition module is used to acquire N indicators based on the user's selection operation on the user interface, wherein each of the N indicators includes metadata, the metadata includes table information, and N is a positive integer greater than or equal to 1. The second acquisition module is used to acquire M related table information when it is detected that the table information of M indicators among the N indicators has corresponding related table information, wherein the related table information is table information with placeholders, and the M related table information includes M placeholders, where M is a positive integer greater than or equal to 1 and less than or equal to N. A generation module is used to replace the table information of the metadata with the table information of the M related tables based on the metadata of the N indicators and the M related table information to generate a first query language, wherein the first query language includes the M placeholders; The filling acquisition module is used to determine the position information of the M placeholders in the first query language, and fill the user's identification information into the position information of the M placeholders respectively to obtain the second query language, so that the user can obtain the indicator data of the N indicators for the user based on the second query language.
8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the data processing method according to any one of claims 1 to 6.
9. An electronic device, comprising: include: processor; Memory used to store the processor's executable instructions. The processor is used to execute the data processing method according to any one of claims 1 to 6.