Data query method and system based on metadata configuration
Through the data query method based on metadata configuration, the problem of low data query efficiency in software development is solved, automated query is realized, labor costs are reduced and development efficiency is improved.
Patent Information
- Application Number
- CN202411630067.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the software development process, on-site implementation personnel need to conduct data queries to confirm the problem, but due to the differences between different database clients, they usually rely on the help of developers, resulting in development efficiency and inefficiency.
Using a data query method based on metadata configuration, by constructing software development information, ensuring network connectivity, collecting table metadata information regularly, configuring association tables and query conditions, and generating query statements, thereby obtaining query results and lowering the threshold for data query.
Query statements can be generated through page configuration to obtain query results, reducing labor costs, improving development efficiency, and simplifying the data query process.
Smart Images

Figure CN119149625A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a data query method and system based on metadata configuration. Background Art
[0002] With the rapid development of science and technology and the improvement of people's living standards, software development technology has become an important force driving innovation and change.
[0003] During the software development process, implementation or delivery personnel need to first download and install the client that connects to the database to query data for data verification. However, different database clients are different. On-site implementation personnel usually do not write the corresponding SQL, but need to perform some simple data queries to confirm the problems in the software. They usually rely on development communication queries to help query and export data, which requires developers to spend a lot of time, affecting development efficiency and work efficiency. Summary of the invention
[0004] Based on this, an object of the present invention is to provide a data query method and system based on metadata configuration, so as to at least solve the deficiencies in the above-mentioned technology.
[0005] The present invention proposes a data query method based on metadata configuration, comprising: Constructing software development information, and making a preset business system dependent on the software development information to obtain a corresponding business development system; The registered node of the caller ensures the network connectivity between the caller and the business development system, and when the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected regularly and in full; configuring a corresponding association table according to the registration node of the caller and the table metadata information, and obtaining a corresponding query field according to the association table and the table metadata information; Corresponding query conditions are configured according to the associated table and the table metadata information, and a specified query statement is generated according to the query conditions, and corresponding query results are obtained from the business development system according to the query statement.
[0006] Further, the steps of constructing software development information and making the preset business system dependent on the software development information to obtain the corresponding business development system include: Build structured query interface, table metadata query interface and data storage interface respectively; Corresponding software development information is constructed according to the structured query interface, the table metadata query interface and the data storage interface, and a preset business system is made dependent on the software development information to obtain a corresponding business development system.
[0007] Further, the steps of ensuring the network connectivity between the caller's registered node and the business development system, and collecting all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task include: Obtaining the IP and port of the caller's registration node, and ensuring network connectivity between the caller and the business development system based on the IP and port; When the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected in full and in a scheduled manner, and the structured query interface of the business development system is called to query all tables in the current database and query the specific column information and primary key information of each table in the current database.
[0008] Furthermore, the step of obtaining the corresponding query field according to the association table and the table metadata information includes: Acquire all column information of the selected table according to the association table and the table metadata information, wherein the column information includes column names and column Chinese names; A corresponding query column is constructed based on the user's query requirements and the column information, and a corresponding query field is created according to the query column.
[0009] The present invention also proposes a data query system based on metadata configuration, comprising: A data development module is used to construct software development information and make a preset business system dependent on the software development information to obtain a corresponding business development system; A data collection module is used to ensure the network connectivity between the caller and the business development system based on the caller's registered node, and to collect all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task; A data configuration module, configured to configure a corresponding association table according to the registration node of the caller and the table metadata information, and obtain a corresponding query field according to the association table and the table metadata information; The data query module is used to configure corresponding query conditions according to the associated table and the table metadata information, generate specified query statements according to the query conditions, and obtain corresponding query results from the business development system according to the query statements.
[0010] Furthermore, the data development module includes: An interface construction unit, used to respectively construct a structured query interface, a table metadata query interface, and a data storage interface; The data development unit is used to construct corresponding software development information according to the structured query interface, the table metadata query interface and the data storage interface, and to make the preset business system dependent on the software development information to obtain the corresponding business development system.
[0011] Furthermore, the data acquisition module includes: A data acquisition unit, used to acquire the IP and port of the registration node of the caller, and ensure the network connectivity between the caller and the business development system according to the IP and port; The data collection unit is used to collect all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task, and call the structured query interface of the business development system to query all tables in the current database and query the specific column information and primary key information of each table in the current database.
[0012] Furthermore, the data configuration module includes: An information acquisition unit, configured to acquire all column information of the selected table according to the association table and the table metadata information, wherein the column information includes column names and column Chinese names; The data configuration unit is used to construct a corresponding query column based on the user's query requirements and the column information, and to create a corresponding query field according to the query column.
[0013] The present invention also provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned data query method based on metadata configuration is implemented.
[0014] The present invention also proposes a computer, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data query method based on metadata configuration when executing the computer program.
[0015] The data query method and system based on metadata configuration in the present invention, by making the preset business system dependent on the constructed software development information and ensuring network connectivity based on the registered node of the caller, when the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected in full and in a scheduled manner, an association table is configured according to the table metadata information and the registered node, and corresponding query information is constructed according to the association table and the table metadata information to obtain the corresponding query results, query statements can be generated through page configuration, and query results can be obtained according to the generated query statements, which reduces the data query threshold and saves labor costs compared with the traditional method of using a client to connect to a database. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1It is a flowchart of a data query method based on metadata configuration in a first embodiment of the present invention; Figure 2 for Figure 1 Detailed flow chart of step S101; Figure 3 for Figure 1 Detailed flow chart of step S102; Figure 4 for Figure 1 Detailed flow chart of step S103; Figure 5 is a structural block diagram of a data query system based on metadata configuration in a second embodiment of the present invention; Figure 6 FIG. 4 is a structural block diagram of a computer in a third embodiment of the present invention.
[0017] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0018] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0020] Embodiment 1 See also Figure 1 , which shows a data query method based on metadata configuration in the first embodiment of the present invention, and the method specifically includes steps S101 to S103: S101, constructing software development information, and making a preset business system dependent on the software development information to obtain a corresponding business development system; For further information, see Figure 2 , the step S101 specifically includes steps S1011~S1012: S1011, constructing a structured query interface, a table metadata query interface, and a data storage interface respectively; S1012, construct corresponding software development information according to the structured query interface, the table metadata query interface and the data storage interface, and make a preset business system dependent on the software development information to obtain a corresponding business development system.
[0021] In the specific implementation, an SDK is developed: pushed to the remote warehouse, and the connected business system depends on this SDK. The SDK specifically includes three capabilities and provides an HTTP access interface to the outside world: a) General SQL query capability: The caller calls the SQL query interface of the business system connected to the SDK by sending an HTTP request (it can be any executable SQL), passing the SQL to be executed and the parameter list. The SDK executes the SQL based on the JDBC PreparedStatement method and obtains the result to the caller; b) Query table metadata information: query column information data according to the table name. The caller calls the business system query table metadata information interface connected to the SDK through HTTP request, and passes the table name to be queried. The SDK queries the primary key information and all column information of the table based on JDBC, including but not limited to the column name, the Chinese name of the column, the database type of the column, and the Java data type corresponding to the column, and obtains the result and gives it to the caller; c) General data storage capability: The caller sends an HTTP request to call the general storage interface of the business system connected to the SDK. The parameter format is as follows: [ { "table": "t_people",--the name of the table to be saved "rows": [---The data row list of the saved table { "people_id": "123",-- the primary key value of the table "name": "xzx"-- a field of the table } ] } ]; Specifically, the SDK first parses and obtains the table name, dynamically parses the table primary key, and then performs an update operation based on the primary key. If the number of updated rows is 0, it means that the primary key does not exist, and then performs an insert operation. The entire update and insert are based on the jdbc PreparedStatement method and the data row dynamic splicing update and insert sql statements; During the data communication process, these three interfaces will perform data encryption and signature verification to prevent the request from being intercepted by the middleman during the HTTP communication process and tampering with the request data; Furthermore, the preset business system is connected to the SDK, and the business system involved is connected to the SDK in step one.
[0022] S102, ensuring the network connectivity between the caller's registered node and the business development system, and collecting all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task; For further information, see Figure 3 , the step S102 specifically includes steps S1021~S1022: S1021, obtaining the IP and port of the registration node of the caller, and ensuring the network connectivity between the caller and the business development system according to the IP and port; S1022, when the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected in full and in a scheduled manner, and the structured query interface of the business development system is called to query all tables in the current database and query the specific column information and primary key information of each table in the current database.
[0023] In the specific implementation, register the business system at the calling end, mainly fill in the IP+port of the registered node to ensure the network connectivity between the calling end and the business system; use the scheduled task at the calling end to regularly collect all the table metadata information of the library where the business node is located; mainly call the SDK's SQL query interface to query all the tables in the current database and query the specific column information and primary key information of each table; and persist these data to the database where the calling end is located.
[0024] S103, configuring a corresponding association table according to the registration node of the caller and the table metadata information, and obtaining a corresponding query field according to the association table and the table metadata information; For further information, see Figure 4 , the step S103 specifically includes steps S1031~S1032: S1031, acquiring all column information of the selected table according to the association table and the table metadata information, wherein the column information includes column names and column Chinese names; S1032: construct a corresponding query column based on the user's query requirement and the column information, and create a corresponding query field according to the query column.
[0025] During the specific implementation, the implementer relies on the registered node of the caller obtained above and the collected metadata information to select the corresponding business system and the associated table; according to the configured associated table and the collected metadata information, all column information of the selected table is obtained, including: column name, column Chinese name, etc. The implementer customizes the query column according to his own query needs and creates corresponding query fields based on the query column.
[0026] S104, configuring corresponding query conditions according to the associated table and the table metadata information, generating a specified query statement according to the query conditions, and acquiring corresponding query results from the business development system according to the query statement.
[0027] In the specific implementation, according to the configured association table and the collected metadata information, all column information of the selected table is obtained, including: column name, column Chinese name, etc. The implementation personnel customize the filtering query conditions according to their own query needs.
[0028] Specifically, a specified query statement SQL is generated based on the query conditions obtained, and the SQL query interface of the business system connected to the SDK is called to obtain data and display it to the calling end.
[0029] In summary, the data query method based on metadata configuration in the above-mentioned embodiment of the present invention, by making the preset business system dependent on the constructed software development information, and ensuring network connectivity based on the registration node of the caller, when the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected in full and in a scheduled manner, and the association table is configured according to the table metadata information and the registration node, and the corresponding query information is constructed according to the association table and the table metadata information to obtain the corresponding query result, and the query statement can be generated through the page configuration, and the query result is obtained according to the generated query statement. Compared with the traditional method of using the client to connect to the database, the data query threshold is lowered and the labor cost is saved.
[0030] Embodiment 2 Another aspect of the present invention is to provide a data query system based on metadata configuration. Figure 5 , which is a data query system based on metadata configuration in a second embodiment of the present invention, the system includes: The data development module 11 is used to construct software development information and make the preset business system dependent on the software development information to obtain the corresponding business development system; Furthermore, the data development module 11 includes: An interface construction unit, used to respectively construct a structured query interface, a table metadata query interface, and a data storage interface; The data development unit is used to construct corresponding software development information according to the structured query interface, the table metadata query interface and the data storage interface, and to make the preset business system dependent on the software development information to obtain the corresponding business development system.
[0031] The data collection module 12 is used to ensure the network connectivity between the caller and the business development system based on the caller's registered node, and to collect all the table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task; Furthermore, the data acquisition module 12 includes: A data acquisition unit, used to acquire the IP and port of the registration node of the caller, and ensure the network connectivity between the caller and the business development system according to the IP and port; The data collection unit is used to collect all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task, and call the structured query interface of the business development system to query all tables in the current database and query the specific column information and primary key information of each table in the current database.
[0032] A data configuration module 13, configured to configure a corresponding association table according to the registration node of the caller and the table metadata information, and obtain a corresponding query field according to the association table and the table metadata information; Furthermore, the data configuration module 13 includes: An information acquisition unit, configured to acquire all column information of the selected table according to the association table and the table metadata information, wherein the column information includes column names and column Chinese names; The data configuration unit is used to construct a corresponding query column based on the user's query requirements and the column information, and to create a corresponding query field according to the query column.
[0033] The data query module 14 is used to configure corresponding query conditions according to the associated table and the table metadata information, generate a specified query statement according to the query conditions, and obtain corresponding query results from the business development system according to the query statement.
[0034] The functions or operation steps implemented when the above modules and units are executed are generally the same as those in the above method embodiments, and will not be repeated here.
[0035] The data query system based on metadata configuration provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the system embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0036] Embodiment 3 The present invention also provides a computer, see Figure 6 , shown is a computer in the third embodiment of the present invention, including a memory 10, a processor 20, and a computer program 30 stored in the memory 10 and executable on the processor 20. When the processor 20 executes the computer program 30, the above-mentioned data query method based on metadata configuration is implemented.
[0037] The memory 10 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10 may be an internal storage unit of a computer, such as a hard disk of the computer. In other embodiments, the memory 10 may also be an external storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Further, the memory 10 may also include both an internal storage unit of the computer and an external storage device. The memory 10 may be used not only to store application software and various types of data installed in the computer, but also to temporarily store data that has been output or is to be output.
[0038] Among them, in some embodiments, the processor 20 can be an electronic control unit (Electronic Control Unit, abbreviated as ECU, also known as a vehicle computer), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run the program code stored in the memory 10 or process data, such as executing access restriction programs, etc.
[0039] It should be pointed out that Figure 6 The structure shown does not constitute a limitation on the computer. In other embodiments, the computer may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0040] The embodiment of the present invention further provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the data query method based on metadata configuration as described above is implemented.
[0041] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0042] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0043] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0044] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0045] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A data query method based on metadata configuration, characterized in that: include: Constructing software development information, and making a preset business system dependent on the software development information to obtain a corresponding business development system; The registered node of the caller ensures the network connectivity between the caller and the business development system, and when the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected regularly and in full; configuring a corresponding association table according to the registration node of the caller and the table metadata information, and obtaining a corresponding query field according to the association table and the table metadata information; Corresponding query conditions are configured according to the associated table and the table metadata information, and a specified query statement is generated according to the query conditions, and corresponding query results are obtained from the business development system according to the query statement.
2. The data query method based on metadata configuration according to claim 1, characterized in that: The steps of constructing software development information and making a preset business system dependent on the software development information to obtain a corresponding business development system include: Build structured query interface, table metadata query interface and data storage interface respectively; Corresponding software development information is constructed according to the structured query interface, the table metadata query interface and the data storage interface, and a preset business system is made dependent on the software development information to obtain a corresponding business development system.
3. The data query method based on metadata configuration according to claim 1, characterized in that: The steps of ensuring the network connectivity between the caller's registered node and the business development system and collecting all table metadata information of the library where the business node is located on a scheduled basis when the caller uses a scheduled task include: Obtaining the IP and port of the caller's registration node, and ensuring network connectivity between the caller and the business development system based on the IP and port; When the caller uses the scheduled task, all table metadata information of the library where the business node is located is collected in full and in a scheduled manner, and the structured query interface of the business development system is called to query all tables in the current database and query the specific column information and primary key information of each table in the current database.
4. The data query method based on metadata configuration according to claim 1, characterized in that: The step of obtaining the corresponding query field according to the association table and the table metadata information includes: Acquire all column information of the selected table according to the association table and the table metadata information, wherein the column information includes column names and column Chinese names; A corresponding query column is constructed based on the user's query requirements and the column information, and a corresponding query field is created according to the query column.
5. A data query system based on metadata configuration, characterized in that: include: A data development module is used to construct software development information and make a preset business system dependent on the software development information to obtain a corresponding business development system; A data collection module is used to ensure the network connectivity between the caller and the business development system based on the caller's registered node, and to collect all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task; A data configuration module, configured to configure a corresponding association table according to the registration node of the caller and the table metadata information, and obtain a corresponding query field according to the association table and the table metadata information; The data query module is used to configure corresponding query conditions according to the associated table and the table metadata information, generate specified query statements according to the query conditions, and obtain corresponding query results from the business development system according to the query statements.
6. The data query system based on metadata configuration according to claim 5, characterized in that: The data development module includes: An interface construction unit, used to respectively construct a structured query interface, a table metadata query interface, and a data storage interface; The data development unit is used to construct corresponding software development information according to the structured query interface, the table metadata query interface and the data storage interface, and to make the preset business system dependent on the software development information to obtain the corresponding business development system.
7. The data query system based on metadata configuration according to claim 5, characterized in that: The data acquisition module comprises: A data acquisition unit, used to acquire the IP and port of the registration node of the caller, and ensure the network connectivity between the caller and the business development system according to the IP and port; The data collection unit is used to collect all table metadata information of the library where the business node is located on a regular basis when the caller uses a scheduled task, and call the structured query interface of the business development system to query all tables in the current database and query the specific column information and primary key information of each table in the current database.
8. The data query system based on metadata configuration according to claim 5, characterized in that: The data configuration module includes: An information acquisition unit, configured to acquire all column information of the selected table according to the association table and the table metadata information, wherein the column information includes column names and column Chinese names; The data configuration unit is used to construct a corresponding query column based on the user's query requirements and the column information, and to create a corresponding query field according to the query column.
9. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data query method based on metadata configuration as described in any one of claims 1 to 4 is implemented.
10. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the data query method based on metadata configuration as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Metadata self-discovery-based data query interface automatic generation method and system
CN110083650A
Data real-time query system in multi-concurrency and multi-channel environment
CN111209467A
Metadata processing method and device, storage medium and server
CN113468166A
Data query method and device, electronic equipment and storage medium
CN116089473A
Service system data monitoring method and device, electronic equipment and storage medium
CN116795636A
