Data query method, device, electronic device and medium based on artificial intelligence
By parsing and verifying database logs to generate entity relationship diagrams, the problem of low efficiency in data table relationship queries in large databases is solved, and efficient and accurate data table relationship queries are achieved.
Patent Information
- Application Number
- CN202210449265.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-04-26
AI Technical Summary
In large databases, since foreign key relationships are abandoned, the efficiency and accuracy of data table relationship queries are low, making it difficult to quickly and accurately determine the association relationships between data tables using existing methods.
By parsing the database log of the target project, generating database join query statements, analyzing the correspondence between the main table and sub-tables based on the table structure information, creating a first entity relationship diagram, and verifying it to generate a second entity relationship diagram, and performing table relationship queries directly in the diagram.
It improves the efficiency and accuracy of data table relationship queries, reduces dependence on developers, and ensures the accuracy of the relationships between data tables.
Smart Images

Figure CN114840522B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based data query method, device, electronic device, and medium. Background Art
[0002] With the development of the Internet, there are more and more data tables in the database. Historically, the table relationships in the database are identified by foreign key relationships. To understand the underlying data storage structure of a project, ER relationship diagrams are directly established based on the database foreign keys. However, with the gradual increase in the number of users, the use of foreign keys has been abandoned. The data table relationships are no longer strongly associated by the database. Instead, you need to enter the interface layer by layer from the page to understand a project.
[0003] However, when understanding a project based on an interface, it is necessary to find the data landing method and location, supplemented by a data relationship design diagram and development assistance, in order to find the data table relationship, resulting in low efficiency and accuracy of data table relationship queries. Summary of the Invention
[0004] In view of the above content, it is necessary to propose a data query method, device, electronic device and medium based on artificial intelligence, which creates a first entity relationship diagram through the configuration information of the target project and the correspondence between the main table and the sub-table, thereby improving the efficiency and accuracy of data table relationship query.
[0005] A first aspect of the present invention provides a data query method based on artificial intelligence, the method comprising:
[0006] Parsing the received data table relationship query request to obtain the target project and the target database log of the target project, as well as the table relationship query conditions;
[0007] Scan database statements in the target database log of the target project to obtain database join query statements;
[0008] Analyze the database join query statement based on the table structure information of the target project to obtain the main table and the sub-tables, as well as the corresponding relationship between the main table and the sub-tables;
[0009] Creating a first entity relationship diagram based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables;
[0010] Verifying the first entity relationship diagram to obtain a second entity relationship diagram;
[0011] A table relationship query is performed in the second entity relationship diagram according to the table relationship query condition to obtain a query result.
[0012] Optionally, parsing the received data table relationship query request to obtain the target project and the target database log of the target project, as well as the table relationship query condition includes:
[0013] Parsing the data table relationship query request to obtain message information of the data table relationship query request;
[0014] Obtaining the name of the target project and table relationship query conditions from the message information;
[0015] Determine an interface of a target database corresponding to the target project based on the name of the target project;
[0016] Obtaining the binary log of the target project through the interface of the target database;
[0017] Call the device side to open binlog, and pass the binary log through the binlog file to obtain the target database log of the target project.
[0018] Optionally, scanning database statements in a target database log of the target project to obtain database join query statements includes:
[0019] Scan each database statement in the target database log of the target project;
[0020] Parsing each database statement to obtain the query conditions and query results in the corresponding query statement;
[0021] Use regular matching to match the query conditions and query results of each database statement to obtain matching results;
[0022] Generate a database join query statement based on the table name, field and value information in the matching result.
[0023] Optionally, analyzing the database join query statement based on the configuration information of the target project to obtain the main table and the sub-tables, as well as the corresponding relationship between the main table and the sub-tables includes:
[0024] Analyze the database query statements and filter out data tables with associated relationships;
[0025] Identify the connection method of data tables with associated relationships;
[0026] When the connection mode of the data tables with the associated relationship is a left join, determining that the left table in the data tables with the associated relationship is a main table and the right table is a sub-table, and identifying whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, determining that the corresponding relationship between the main table and the sub-table is a preset first corresponding relationship;
[0027] When the connection mode of the data tables with an associated relationship is a right join, it is determined that the right table in the data tables with an associated relationship is the main table and the left table is the sub-table, and it is identified whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, the corresponding relationship between the main table and the sub-table is a preset second corresponding relationship.
[0028] Optionally, the method further includes:
[0029] When the connection mode of the data tables with the association relationship is inner connection, obtaining the table names of the two tables with inner connection;
[0030] Traversing the table structure information based on the table names of the two tables to obtain a traversal result;
[0031] When the two corresponding tables in the traversal result are in a one-to-one relationship, determining that the corresponding relationship between the two tables in the data table with an associated relationship is a preset third corresponding relationship;
[0032] When the two corresponding tables in the traversal result are not in a one-to-one relationship, the connection mode of the data tables with the associated relationship is updated based on the traversal result.
[0033] Optionally, the creating a first entity relationship diagram based on the configuration information of the target project and the correspondence between the main table and the sub-tables includes:
[0034] Obtaining the target entity to be displayed from the configuration information of the target project;
[0035] Extracting the target entity to be displayed from the corresponding relationship;
[0036] Extracting features corresponding to the target entity from the corresponding relationship as attributes;
[0037] Extracting the relationship and relationship cardinality between the target entities from the corresponding relationship;
[0038] A first entity relationship diagram is generated according to the target entity, the attributes, the relationships and the relationship cardinality using a preset entity relationship diagram generation tool.
[0039] Optionally, after obtaining the second entity relationship diagram, the method further includes:
[0040] Identify a type of relationship schema in the second entity-relationship diagram;
[0041] Obtaining the conversion rules corresponding to the relational schema type;
[0042] The second entity relationship diagram is mapped into a relationship table using the conversion rule.
[0043] A second aspect of the present invention provides an artificial intelligence-based data query device, comprising:
[0044] The parsing and obtaining module is used to parse the received data table relationship query request, obtain the target project and the target database log of the target project, and the table relationship query condition;
[0045] A scanning module, configured to scan database statements in a target database log of the target project to obtain database join query statements;
[0046] An analysis module, configured to analyze the database join query statement based on the table structure information of the target project to obtain a main table and sub-tables, as well as a corresponding relationship between the main table and the sub-tables;
[0047] A creation module, configured to create a first entity relationship diagram based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables;
[0048] A verification module, configured to verify the first entity relationship diagram to obtain a second entity relationship diagram;
[0049] A query module is used to perform a table relationship query in the second entity relationship diagram according to the table relationship query condition to obtain a query result.
[0050] A third aspect of the present invention provides an electronic device, comprising a processor and a memory, wherein the processor is configured to implement the artificial intelligence-based data query method when executing a computer program stored in the memory.
[0051] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the artificial intelligence-based data query method when executed by a processor.
[0052] In summary, the artificial intelligence-based data query method, device, electronic device and medium of the present invention obtain database joint query statements by scanning the database statements in the target database log of the target project, analyze the database joint query statements based on the table structure information of the target project, obtain the main table and sub-table, and the corresponding relationship between the main table and the sub-table, obtain the database joint query statements by reversely analyzing the target database log, query the relationship between the tables, without the need for foreign keys or developers to reversely infer data relationships from the page, thereby improving the efficiency of obtaining data table relationships, and at the same time, verifying the relationship between the tables obtained by the query based on the table structure information of the target project, thereby improving the accuracy of determining the main table and sub-table. Based on the configuration information of the target project and the corresponding relationship between the main table and the sub-table, a first entity relationship diagram is created, so that developers can intuitively see the relationship between each data table in the target code library, thereby improving the efficiency of data table relationship query, and at the same time, the first entity relationship diagram is verified to obtain a second entity relationship diagram, thereby ensuring the accuracy of the relationship between each table in the second entity relationship diagram, thereby improving the efficiency and accuracy of data table relationship query. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 This is a flowchart of the artificial intelligence-based data query method provided in Example 1 of the present invention.
[0054] Figure 2 This is a structural diagram of an artificial intelligence-based data query device provided in Example 2 of the present invention.
[0055] Figure 3 It is a structural diagram of an electronic device provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0056] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features therein can be combined with each other without conflict.
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0058] Example 1
[0059] Figure 1 This is a flowchart of the artificial intelligence-based data query method provided in Example 1 of the present invention.
[0060] In this embodiment, the artificial intelligence-based data query method can be applied to electronic devices. For electronic devices that need to perform artificial intelligence-based data query, the artificial intelligence-based data query function provided by the method of the present invention can be directly integrated into the electronic device, or run in the electronic device in the form of a software development kit (SDK).
[0061] Embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0062] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, machine learning, and deep learning.
[0063] like Figure 1 As shown, the artificial intelligence-based data query method specifically includes the following steps. According to different needs, the order of the steps in the flowchart can be changed, and some can be omitted.
[0064] S11, parsing the received data table relationship query request, obtaining the target project and the target database log of the target project, and the table relationship query condition.
[0065] In this embodiment, in the field of digital medicine and project development, in order to quickly obtain the project content of the target project, the client sends a data relationship query request to the server. The server analyzes the association relationship between each data table in the target database log of the target project corresponding to the data relationship query request, and obtains the project content based on the association relationship between each data table, that is, obtains the logical structure relationship of the project content. According to the logical relationship of the project content, it can assist in the maintenance, addition, reduction and reconstruction of the project content in the later stage, thereby shortening the project development cycle.
[0066] In this embodiment, the table relationship query conditions may include: query time range, query content, query project information, etc.
[0067] In an optional embodiment, parsing the received data table relationship query request, obtaining the target project and the target database log of the target project, and the table relationship query condition includes:
[0068] Parsing the data table relationship query request to obtain message information of the data table relationship query request;
[0069] Obtaining the name of the target project and table relationship query conditions from the message information;
[0070] Determine an interface of a target database corresponding to the target project based on the name of the target project;
[0071] Obtaining the binary log of the target project through the interface of the target database;
[0072] Call the device side to open binlog, and pass the binary log through the binlog file to obtain the target database log of the target project.
[0073] In this embodiment, the name of each target project corresponds to a target database interface.
[0074] In this embodiment, since foreign key relationships have basically been abandoned, how to obtain the accurate table logical structure without the database itself has become a difficult problem. To prevent data problems from being unable to be traced back, the binary log of the target project is converted into a binlog log and the binlog log is parsed to obtain the database join query statement.
[0075] S12, scanning database statements in the target database log of the target project to obtain database join query statements.
[0076] In this embodiment, the database joint query statement refers to a database statement of an association relationship existing in the binlog log, and the database joint query statement can be obtained by analyzing the database statement.
[0077] In an optional embodiment, scanning the database statements in the target database log of the target project to obtain the database join query statement includes:
[0078] Scan each database statement in the target database log of the target project;
[0079] Parsing each database statement to obtain the query conditions and query results in the corresponding query statement;
[0080] Use regular matching to match the query conditions and query results of each database statement to obtain matching results;
[0081] Generate a database join query statement based on the table name, field and value information in the matching result.
[0082] In this embodiment, each database statement in the target database log of the target project includes a query condition and a query result. By matching the query conditions and query results in multiple database statements, a database joint query statement is generated.
[0083] S13, analyzing the database join query statement based on the table structure information of the target project to obtain a main table and sub-tables, as well as a corresponding relationship between the main table and the sub-tables.
[0084] In this embodiment, the corresponding relationship includes all associated field information of the data table and the association relationship between the fields.
[0085] In this embodiment, by analyzing the database query statement, the association relationship between the data tables in the target code library can be obtained. When there is an association relationship between a data table and other data tables, the main table and sub-table in the data table with the association relationship, and the corresponding relationship between the main table and the sub-table are determined; when there is no association between the data table and other data tables, the data table without the association is used as the basic data table and is not processed. At the same time, the basic data table does not involve project data, and mainly stores instance data and table structure annotations, etc.
[0086] In an optional embodiment, analyzing the database join query statement based on the configuration information of the target project to obtain the main table and the sub-tables, as well as the corresponding relationship between the main table and the sub-tables includes:
[0087] Analyze the database query statements and filter out data tables with associated relationships;
[0088] Identify the connection method of data tables with associated relationships;
[0089] When the connection mode of the data tables with the associated relationship is a left join, determining that the left table in the data tables with the associated relationship is a main table and the right table is a sub-table, and identifying whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, determining that the corresponding relationship between the main table and the sub-table is a preset first corresponding relationship;
[0090] When the connection mode of the data tables with an associated relationship is a right join, it is determined that the right table in the data tables with an associated relationship is the main table and the left table is the sub-table, and it is identified whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, the corresponding relationship between the main table and the sub-table is a preset second corresponding relationship.
[0091] In other optional embodiments, the method further includes:
[0092] When the connection mode of the data tables with the association relationship is inner connection, obtaining the table names of the two tables with inner connection;
[0093] Traversing the table structure information based on the table names of the two tables to obtain a traversal result;
[0094] When the two corresponding tables in the traversal result are in a one-to-one relationship, determining that the corresponding relationship between the two tables in the data table with an associated relationship is a preset third corresponding relationship;
[0095] When the two corresponding tables in the traversal result are not in a one-to-one relationship, the connection mode of the data tables with the associated relationship is updated based on the traversal result.
[0096] Furthermore, the identifying whether the main table and the sub-table are consistent with the main table and the sub-table corresponding to the table structure information further includes:
[0097] When the main table and the sub-table are not completely consistent with the corresponding main table and the sub-table in the table structure information, the connection mode of the data tables with the associated relationship is updated based on the table structure information of the target project.
[0098] In this embodiment, the preset first corresponding relationship is 1:N, the preset second corresponding relationship is N:1, and the preset third corresponding relationship is 1:1, wherein N is a natural number, 1:N indicates that the mapping relationship between data tables is 1 to many, N:1 indicates that the mapping relationship between data tables is many to 1, and 1:1 indicates that the mapping relationship between data tables is 1 to 1.
[0099] In this embodiment, the 1-to-many (1:N) relationship means, for example, that an entity in table A has a relationship with at least N entities in table B; and each entity in table B has a relationship with at most one entity in table A.
[0100] In this embodiment, the many-to-1 (N:1) relationship means, for example, that an entity in data table B has a relationship with at least N entities in data table A; and each entity in data table A has a relationship with at most one entity in data table B.
[0101] In this embodiment, the 1 to 1 (1:1) relationship refers to, for example, data table A and data table B, each entity in data table A has a relationship with at most one entity in data table B; conversely, each entity in data table B has a relationship with at most one entity in data table A.
[0102] In this embodiment, the entity is an objectively existing and distinguishable thing, referring to a collection of a certain type of things, and the individual of each type of data object is called an entity.
[0103] In this embodiment, by reverse analyzing the target database log, obtaining the database join query statement, and querying the relationship between tables, there is no need to use foreign keys or developers to reversely infer data relationships from the page, which improves the efficiency of obtaining data table relationships. At the same time, based on the table structure information of the target project, the relationship between the tables obtained by the query is verified, thereby improving the accuracy of determining the main table and sub-table.
[0104] S14: Create a first entity relationship diagram based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables.
[0105] In this embodiment, the first entity relationship diagram is an ER diagram (Entity Relationship Diagram), which consists of entities, attributes, relationships, and cardinality. Entities are distinct entities, such as specific users, transaction orders, and products, and are represented by rectangular boxes. Attributes are characteristics of entities, represented by ovals. For example, the attributes corresponding to users are user identification code, gender, region, and age. Relationships reflect the mapping relationship between two entities, represented by diamonds. For example, there is a mapping relationship between products and transaction orders. Cardinality is the number of possible relationships between instances of the two entities associated with the defined relationship, such as one-to-one, one-to-many, many-to-one, etc.
[0106] In an optional embodiment, the creating a first entity relationship diagram based on the configuration information of the target project and the correspondence between the main table and the sub-tables includes:
[0107] Obtaining the target entity to be displayed from the configuration information of the target project;
[0108] Extracting the target entity to be displayed from the corresponding relationship;
[0109] Extracting features corresponding to the target entity from the corresponding relationship as attributes;
[0110] Extracting the relationship and relationship cardinality between the target entities from the corresponding relationship;
[0111] A first entity relationship diagram is generated according to the target entity, the attributes, the relationships and the relationship cardinality using a preset entity relationship diagram generation tool.
[0112] In this embodiment, the target project configuration information includes multiple entities. For example, users, products, transaction orders, payment orders and sub-orders in the e-commerce platform buyer order system are all entities, and the target entities that need to be displayed are users, products and payment orders.
[0113] In this embodiment, the preset drawing tool can be selected from tools such as DbSchema, PowerDesigner, and ERStudio.
[0114] In this embodiment, after the first entity relationship diagram is generated, if attribute conflicts, naming conflicts, structural conflicts, redundant data and redundant inter-entity connections occur in each entity relationship diagram, the first entity relationship diagram needs to be modified or reconstructed. In addition, normalization theory can also be used to eliminate the redundant data and redundant inter-entity connections.
[0115] In this embodiment, by obtaining the target entity to be displayed from the configuration information of the target project instead of displaying all entities in the corresponding relationship, the interference data in the first entity relationship diagram is reduced, and the creation efficiency and accuracy of the first entity relationship diagram are improved. At the same time, the first entity relationship diagram is generated by using a preset drawing tool, and developers can intuitively see the association relationship between each data table in the target code library, thereby improving the efficiency of data table relationship query.
[0116] S15: Verify the first entity relationship diagram to obtain a second entity relationship diagram.
[0117] In this embodiment, in order to further ensure the accuracy of the correspondence between the data tables in the first entity relationship diagram, the first entity relationship diagram is verified.
[0118] In an optional embodiment, verifying the first entity relationship diagram to obtain the second entity relationship diagram includes:
[0119] Randomly extracting a log to be verified from the target database log;
[0120] Scan the database statements in the log to be verified to obtain database joint query statements;
[0121] Analyze the database join query statement based on the table structure information of the target project to obtain the main table to be verified and the sub-table to be verified, as well as the corresponding relationship between the main table to be verified and the sub-table to be verified;
[0122] Determine whether the main table to be verified and the sub-table to be verified are consistent with the main table and sub-table corresponding to the first entity relationship diagram;
[0123] When the main table to be verified and the sub-table to be verified are consistent with the main table and sub-table corresponding to the first entity relationship diagram, determining the first entity relationship diagram as the second entity relationship diagram;
[0124] When the main table to be verified and the sub-table to be verified are not consistent with the main table and sub-table corresponding to the first entity relationship diagram, the first entity relationship diagram is verified according to a preset verification rule to obtain a verification result, and the first entity relationship diagram is updated based on the verification result to obtain a second entity relationship diagram.
[0125] In this embodiment, by randomly extracting the logs to be verified from the target database logs and verifying the first entity relationship diagram, the accuracy of the association relationship between the tables in the second entity relationship diagram is ensured, thereby improving the efficiency and accuracy of data table relationship queries.
[0126] Furthermore, after obtaining the second entity relationship diagram, the method further includes:
[0127] Identify a type of relationship schema in the second entity-relationship diagram;
[0128] Obtaining the conversion rules corresponding to the relational schema type;
[0129] The second entity relationship diagram is mapped into a relationship table using the conversion rule.
[0130] In this embodiment, the relationship pattern types include unary relationship types, binary relationship types, ternary relationship types, etc. Different conversion rules can be set in advance according to different relationship pattern types.
[0131] In this embodiment, the relationship table contains rows (non-duplicate), columns (attributes), primary keys, and foreign keys; the foreign keys represent the connections between two relationship tables. The relationship table more intuitively and detailedly displays the relationships between the data tables, allowing developers to intuitively see the relationships between the various data tables in the target code library, thereby improving the efficiency and accuracy of data table relationship queries.
[0132] S16: Perform a table relationship query in the second entity relationship diagram according to the table relationship query condition to obtain a query result.
[0133] In this embodiment, based on the table relationship query conditions, the relationship between the data tables is directly extracted from the second entity relationship diagram, without the need for foreign keys or developers to reversely infer data relationships from the page, thereby improving the efficiency of data table relationship queries.
[0134] In summary, the artificial intelligence-based data query method described in this embodiment obtains database query statements by scanning the database statements in the target database log of the target project, analyzes the database query statements based on the table structure information of the target project, obtains the main table and sub-tables, and the corresponding relationship between the main table and the sub-tables, obtains the database query statements by reversely analyzing the target database log, and queries the relationship between the tables without the need for foreign keys or developers to reversely infer data relationships from the page, thereby improving the efficiency of obtaining data table relationships, and at the same time, verifies the relationship between the tables obtained by the query based on the table structure information of the target project, thereby improving the accuracy of determining the main table and sub-tables. Based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables, a first entity relationship diagram is created, so that developers can intuitively see the relationship between each data table in the target code library, thereby improving the efficiency of data table relationship query, and at the same time, the first entity relationship diagram is verified to obtain a second entity relationship diagram, thereby ensuring the accuracy of the relationship between each table in the second entity relationship diagram, thereby improving the efficiency and accuracy of data table relationship query.
[0135] Example 2
[0136] Figure 2 This is a structural diagram of an artificial intelligence-based data query device provided in Example 2 of the present invention.
[0137] In some embodiments, the artificial intelligence-based data query device 20 may include a plurality of functional modules composed of program code segments. The program code of each program segment in the artificial intelligence-based data query device 20 may be stored in the memory of the electronic device and executed by the at least one processor to perform (see Figure 1 Description) Function of data query based on artificial intelligence.
[0138] In this embodiment, the artificial intelligence-based data query device 20 can be divided into multiple functional modules based on the functions it performs. The functional modules may include: a parsing and acquisition module 201, a scanning module 202, an analysis module 203, a creation module 204, a verification module 205, and a query module 206. As used herein, a module refers to a series of computer-readable instruction segments that can be executed by at least one processor and can perform a fixed function, and is stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0139] The parsing and obtaining module 201 is used to parse the received data table relationship query request, obtain the target project and the target database log of the target project, and the table relationship query condition.
[0140] In this embodiment, in the field of digital medicine and project development, in order to quickly obtain the project content of the target project, the client sends a data relationship query request to the server. The server analyzes the association relationship between each data table in the target database log of the target project corresponding to the data relationship query request, and obtains the project content based on the association relationship between each data table, that is, obtains the logical structure relationship of the project content. According to the logical relationship of the project content, it can assist in the maintenance, addition, reduction and reconstruction of the project content in the later stage, thereby shortening the project development cycle.
[0141] In this embodiment, the table relationship query conditions may include: query time range, query content, query project information, etc.
[0142] In an optional embodiment, the parsing and obtaining module 201 parses the received data table relationship query request, obtains the target project and the target database log of the target project, and the table relationship query conditions include:
[0143] Parsing the data table relationship query request to obtain message information of the data table relationship query request;
[0144] Obtaining the name of the target project and table relationship query conditions from the message information;
[0145] Determine an interface of a target database corresponding to the target project based on the name of the target project;
[0146] Obtaining the binary log of the target project through the interface of the target database;
[0147] Call the device side to open binlog, and pass the binary log through the binlog file to obtain the target database log of the target project.
[0148] In this embodiment, the name of each target project corresponds to a target database interface.
[0149] In this embodiment, since foreign key relationships have basically been abandoned, how to obtain the accurate table logical structure without the database itself has become a difficult problem. To prevent data problems from being unable to be traced back, the binary log of the target project is converted into a binlog log and the binlog log is parsed to obtain the database join query statement.
[0150] The scanning module 202 is configured to scan database statements in the target database log of the target project to obtain database join query statements.
[0151] In this embodiment, the database joint query statement refers to a database statement of an association relationship existing in the binlog log, and the database joint query statement can be obtained by analyzing the database statement.
[0152] In an optional embodiment, the scanning module 202 scans the database statements in the target database log of the target project, and obtains the database join query statements including:
[0153] Scan each database statement in the target database log of the target project;
[0154] Parsing each database statement to obtain the query conditions and query results in the corresponding query statement;
[0155] Use regular matching to match the query conditions and query results of each database statement to obtain matching results;
[0156] Generate a database join query statement based on the table name, field and value information in the matching result.
[0157] In this embodiment, each database statement in the target database log of the target project includes a query condition and a query result. By matching the query conditions and query results in multiple database statements, a database joint query statement is generated.
[0158] The analysis module 203 is configured to analyze the database join query statement based on the table structure information of the target project to obtain the main table and sub-tables, as well as the corresponding relationship between the main table and the sub-tables.
[0159] In this embodiment, the corresponding relationship includes all associated field information of the data table and the association relationship between the fields.
[0160] In this embodiment, by analyzing the database query statement, the association relationship between the data tables in the target code library can be obtained. When there is an association relationship between a data table and other data tables, the main table and sub-table in the data table with the association relationship, and the corresponding relationship between the main table and the sub-table are determined; when there is no association between the data table and other data tables, the data table without the association is used as the basic data table and is not processed. At the same time, the basic data table does not involve project data, and mainly stores instance data and table structure annotations, etc.
[0161] In an optional embodiment, the analysis module 203 analyzes the database join query statement based on the configuration information of the target project to obtain the main table and the sub-tables, and the corresponding relationship between the main table and the sub-tables includes:
[0162] Analyze the database query statements and filter out data tables with associated relationships;
[0163] Identify the connection method of data tables with associated relationships;
[0164] When the connection mode of the data tables with the associated relationship is a left join, determining that the left table in the data tables with the associated relationship is a main table and the right table is a sub-table, and identifying whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, determining that the corresponding relationship between the main table and the sub-table is a preset first corresponding relationship;
[0165] When the connection mode of the data tables with an associated relationship is a right join, it is determined that the right table in the data tables with an associated relationship is the main table and the left table is the sub-table, and it is identified whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, the corresponding relationship between the main table and the sub-table is a preset second corresponding relationship.
[0166] In other optional embodiments, when the connection mode of the data tables with an associated relationship is an inner join, the table names of the two tables with an inner join are obtained; the table structure information is traversed based on the table names of the two tables to obtain a traversal result; when the two corresponding tables in the traversal result are in a one-to-one relationship, it is determined that the correspondence between the two tables in the data tables with an associated relationship is a preset third correspondence; when the two corresponding tables in the traversal result are not in a one-to-one relationship, the connection mode of the data tables with an associated relationship is updated based on the traversal result.
[0167] Furthermore, the identifying whether the main table and the sub-table are consistent with the main table and the sub-table corresponding to the table structure information further includes:
[0168] When the main table and the sub-table are not completely consistent with the corresponding main table and the sub-table in the table structure information, the connection mode of the data tables with the associated relationship is updated based on the table structure information of the target project.
[0169] In this embodiment, the preset first corresponding relationship is 1:N, the preset second corresponding relationship is N:1, and the preset third corresponding relationship is 1:1, wherein N is a natural number, 1:N indicates that the mapping relationship between data tables is 1 to many, N:1 indicates that the mapping relationship between data tables is many to 1, and 1:1 indicates that the mapping relationship between data tables is 1 to 1.
[0170] In this embodiment, the 1-to-many (1:N) relationship means, for example, that an entity in table A has a relationship with at least N entities in table B; and each entity in table B has a relationship with at most one entity in table A.
[0171] In this embodiment, the many-to-1 (N:1) relationship means, for example, that an entity in data table B has a relationship with at least N entities in data table A; and each entity in data table A has a relationship with at most one entity in data table B.
[0172] In this embodiment, the 1 to 1 (1:1) relationship refers to, for example, data table A and data table B, each entity in data table A has a relationship with at most one entity in data table B; conversely, each entity in data table B has a relationship with at most one entity in data table A.
[0173] In this embodiment, the entity is an objectively existing and distinguishable thing, referring to a collection of a certain type of things, and the individual of each type of data object is called an entity.
[0174] In this embodiment, by reverse analyzing the target database log, obtaining the database join query statement, and querying the relationship between tables, there is no need to use foreign keys or developers to reversely infer data relationships from the page, which improves the efficiency of obtaining data table relationships. At the same time, based on the table structure information of the target project, the relationship between the tables obtained by the query is verified, thereby improving the accuracy of determining the main table and sub-table.
[0175] The creation module 204 is configured to create a first entity relationship diagram based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables.
[0176] In this embodiment, the first entity relationship diagram is an ER diagram (Entity Relationship Diagram), which consists of entities, attributes, relationships, and cardinality. Entities are distinct entities, such as specific users, transaction orders, and products, and are represented by rectangular boxes. Attributes are characteristics of entities, represented by ovals. For example, the attributes corresponding to users are user identification code, gender, region, and age. Relationships reflect the mapping relationship between two entities, represented by diamonds. For example, there is a mapping relationship between products and transaction orders. Cardinality is the number of possible relationships between instances of the two entities associated with the defined relationship, such as one-to-one, one-to-many, many-to-one, etc.
[0177] In an optional embodiment, the creation module 204 creates the first entity relationship diagram based on the configuration information of the target project and the correspondence between the main table and the sub-tables, including:
[0178] Obtaining the target entity to be displayed from the configuration information of the target project;
[0179] Extracting the target entity to be displayed from the corresponding relationship;
[0180] Extracting features corresponding to the target entity from the corresponding relationship as attributes;
[0181] Extracting the relationship and relationship cardinality between the target entities from the corresponding relationship;
[0182] A first entity relationship diagram is generated according to the target entity, the attributes, the relationships and the relationship cardinality using a preset entity relationship diagram generation tool.
[0183] In this embodiment, the target project configuration information includes multiple entities. For example, users, products, transaction orders, payment orders and sub-orders in the e-commerce platform buyer order system are all entities, and the target entities that need to be displayed are users, products and payment orders.
[0184] In this embodiment, the preset drawing tool can be selected from tools such as DbSchema, PowerDesigner, and ERStudio.
[0185] In this embodiment, after the first entity relationship diagram is generated, if attribute conflicts, naming conflicts, structural conflicts, redundant data and redundant inter-entity connections occur in each entity relationship diagram, the first entity relationship diagram needs to be modified or reconstructed. In addition, normalization theory can also be used to eliminate the redundant data and redundant inter-entity connections.
[0186] In this embodiment, by obtaining the target entity to be displayed from the configuration information of the target project instead of displaying all entities in the corresponding relationship, the interference data in the first entity relationship diagram is reduced, and the creation efficiency and accuracy of the first entity relationship diagram are improved. At the same time, the first entity relationship diagram is generated by using a preset drawing tool, and developers can intuitively see the association relationship between each data table in the target code library, thereby improving the efficiency of data table relationship query.
[0187] The verification module 205 is configured to verify the first entity relationship diagram to obtain a second entity relationship diagram.
[0188] In this embodiment, in order to further ensure the accuracy of the correspondence between the data tables in the first entity relationship diagram, the first entity relationship diagram is verified.
[0189] In an optional embodiment, the verification module 205 verifies the first entity relationship diagram to obtain the second entity relationship diagram including:
[0190] Randomly extracting a log to be verified from the target database log;
[0191] Scan the database statements in the log to be verified to obtain database joint query statements;
[0192] Analyze the database join query statement based on the table structure information of the target project to obtain the main table to be verified and the sub-table to be verified, as well as the corresponding relationship between the main table to be verified and the sub-table to be verified;
[0193] Determine whether the main table to be verified and the sub-table to be verified are consistent with the main table and sub-table corresponding to the first entity relationship diagram;
[0194] When the main table to be verified and the sub-table to be verified are consistent with the main table and sub-table corresponding to the first entity relationship diagram, determining the first entity relationship diagram as the second entity relationship diagram;
[0195] When the main table to be verified and the sub-table to be verified are not consistent with the main table and sub-table corresponding to the first entity relationship diagram, the first entity relationship diagram is verified according to a preset verification rule to obtain a verification result, and the first entity relationship diagram is updated based on the verification result to obtain a second entity relationship diagram.
[0196] In this embodiment, by randomly extracting the logs to be verified from the target database logs and verifying the first entity relationship diagram, the accuracy of the association relationship between the tables in the second entity relationship diagram is ensured, thereby improving the efficiency and accuracy of data table relationship queries.
[0197] Furthermore, after obtaining the second entity relationship diagram, the relationship pattern type in the second entity relationship diagram is identified; a conversion rule corresponding to the relationship pattern type is obtained; and the second entity relationship diagram is mapped into a relationship table using the conversion rule.
[0198] In this embodiment, the relationship pattern types include unary relationship types, binary relationship types, ternary relationship types, etc. Different conversion rules can be set in advance according to different relationship pattern types.
[0199] In this embodiment, the relationship table contains rows (non-duplicate), columns (attributes), primary keys, and foreign keys; the foreign keys represent the connections between two relationship tables. The relationship table more intuitively and detailedly displays the relationships between the data tables, allowing developers to intuitively see the relationships between the various data tables in the target code library, thereby improving the efficiency and accuracy of data table relationship queries.
[0200] The query module 206 is configured to perform a table relationship query in the second entity relationship diagram according to the table relationship query condition to obtain a query result.
[0201] In this embodiment, based on the table relationship query conditions, the relationship between the data tables is directly extracted from the second entity relationship diagram, without the need for foreign keys or developers to reversely infer data relationships from the page, thereby improving the efficiency of data table relationship queries.
[0202] In summary, the artificial intelligence-based data query device described in this embodiment obtains database query statements by scanning the database statements in the target database log of the target project, analyzes the database query statements based on the table structure information of the target project, obtains the main table and sub-tables, and the corresponding relationship between the main table and the sub-tables, obtains the database query statements by reversely analyzing the target database log, and queries the relationship between tables without the need for foreign keys or developers to reversely infer data relationships from the page, thereby improving the efficiency of obtaining data table relationships, and at the same time, verifies the relationship between the tables obtained by the query based on the table structure information of the target project, thereby improving the accuracy of determining the main table and sub-tables. Based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables, a first entity relationship diagram is created, so that developers can intuitively see the relationship between each data table in the target code library, thereby improving the efficiency of data table relationship query, and at the same time, the first entity relationship diagram is verified to obtain a second entity relationship diagram, thereby ensuring the accuracy of the relationship between each table in the second entity relationship diagram, thereby improving the efficiency and accuracy of data table relationship query.
[0203] Example 3
[0204] See Figure 3 FIG. 3 is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. In a preferred embodiment of the present invention, the electronic device 3 includes a memory 31 , at least one processor 32 , at least one communication bus 33 and a transceiver 34 .
[0205] Those skilled in the art should understand that Figure 3 The structure of the electronic device shown does not constitute a limitation of the embodiments of the present invention, and can be either a bus structure or a star structure. The electronic device 3 can also include more or less other hardware or software than shown in the figure, or a different component arrangement.
[0206] In some embodiments, the electronic device 3 is an electronic device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. The electronic device 3 may also include a client device, which includes but is not limited to any electronic product capable of human-computer interaction with a client via a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as a personal computer, tablet computer, smartphone, digital camera, etc.
[0207] It should be noted that the electronic device 3 is only an example. Other existing or future electronic products that are suitable for the present invention should also be included in the protection scope of the present invention and included here by reference.
[0208] In some embodiments, the memory 31 is used to store program codes and various data, such as the artificial intelligence-based data query device 20 installed in the electronic device 3, and to achieve high-speed and automatic access to programs or data during the operation of the electronic device 3. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0209] In some embodiments, the at least one processor 32 may be composed of an integrated circuit, such as a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The at least one processor 32 is the control core (Control Unit) of the electronic device 3, connecting the various components of the entire electronic device 3 using various interfaces and lines, and executing or executing programs or modules stored in the memory 31, as well as calling data stored in the memory 31, to perform various functions of the electronic device 3 and process data.
[0210] In some embodiments, the at least one communication bus 33 is configured to implement connection and communication between the memory 31 and the at least one processor 32 .
[0211] Although not shown, the electronic device 3 may also include a power source (such as a battery) to power various components. Optionally, the power source may be logically connected to the at least one processor 32 via a power management device, thereby enabling the power management device to manage charging, discharging, and power consumption. The power source may also include one or more DC or AC power sources, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components. The electronic device 3 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be detailed here.
[0212] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0213] The above-mentioned integrated unit implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module stored in a storage medium includes a number of instructions for causing a computer device (which can be a personal computer, electronic device, or network device, etc.) or a processor to execute portions of the methods described in various embodiments of the present invention.
[0214] In a further embodiment, in combination Figure 2 The at least one processor 32 can execute the operating device of the electronic device 3 and various installed applications (such as the artificial intelligence-based data query device 20), program codes, etc., for example, the above-mentioned modules.
[0215] The memory 31 stores program codes, and the at least one processor 32 can call the program codes stored in the memory 31 to execute related functions. For example, Figure 2 The modules described are program codes stored in the memory 31 and executed by the at least one processor 32, thereby realizing the functions of the modules to achieve the purpose of data query based on artificial intelligence.
[0216] Exemplarily, the program code may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 32 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, which are used to describe the execution process of the program code in the electronic device 3. For example, the program code may be divided into a parsing and acquisition module 201, a scanning module 202, an analysis module 203, a creation module 204, a verification module 205, and a query module 206.
[0217] In one embodiment of the present invention, the memory 31 stores a plurality of computer-readable instructions, and the plurality of computer-readable instructions are executed by the at least one processor 32 to implement a data query function based on artificial intelligence.
[0218] Specifically, the specific implementation method of the at least one processor 32 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0219] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and actual implementation may employ other division methods.
[0220] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, and may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of this embodiment based on actual needs.
[0221] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.
[0222] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be regarded as exemplary and non-restrictive from any point of view, and the scope of the invention is defined by the appended claims rather than the above description, and it is intended that all variations that fall within the meaning and scope of the equivalents of the claims be encompassed within the present invention. Any reference numerals in the claims should not be construed as limiting the claims to which they relate. Furthermore, it is apparent that the word "comprising" does not exclude other units or, and the singular does not exclude the plural. The multiple units or devices set forth in the present invention may also be implemented by one unit or device through software or hardware. Words such as first and second are used to indicate names and do not indicate any particular order.
[0223] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A data query method based on artificial intelligence, characterized in that: The method comprises: Parsing the received data table relationship query request to obtain the target project and the target database log of the target project, as well as the table relationship query conditions; Scan database statements in the target database log of the target project to obtain database join query statements; Analyze the database join query statement based on the table structure information of the target project to obtain the main table and the sub-tables, as well as the corresponding relationship between the main table and the sub-tables; Creating a first entity relationship diagram based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables; Verifying the first entity relationship diagram to obtain a second entity relationship diagram, including: randomly extracting a log to be verified from the target database log; scanning database statements in the log to be verified to obtain a database join query statement corresponding to the log to be verified; analyzing the database join query statement corresponding to the log to be verified based on the table structure information of the target project to obtain a main table to be verified and a sub-table to be verified, as well as a correspondence between the main table to be verified and the sub-table to be verified; judging whether the main table to be verified and the sub-table to be verified are consistent with the main table and the sub-table corresponding to the first entity relationship diagram; when the main table to be verified and the sub-table to be verified are consistent with the main table and the sub-table corresponding to the first entity relationship diagram, determining the first entity relationship diagram as the second entity relationship diagram; when the main table to be verified and the sub-table to be verified are not consistent with the main table and the sub-table corresponding to the first entity relationship diagram, verifying the first entity relationship diagram according to a preset verification rule to obtain a verification result, and updating the first entity relationship diagram based on the verification result to obtain a second entity relationship diagram; A table relationship query is performed in the second entity relationship diagram according to the table relationship query condition to obtain a query result.
2. The artificial intelligence-based data query method according to claim 1, characterized in that: The parsing of the received data table relationship query request to obtain the target project and the target database log of the target project, as well as the table relationship query conditions include: Parsing the data table relationship query request to obtain message information of the data table relationship query request; Obtaining the name of the target project and table relationship query conditions from the message information; Determine an interface of a target database corresponding to the target project based on the name of the target project; Obtaining the binary log of the target project through the interface of the target database; Call the device side to open binlog, and pass the binary log through the binlog file to obtain the target database log of the target project.
3. The data query method based on artificial intelligence according to claim 1, characterized in that: Scanning the database statements in the target database log of the target project to obtain the database join query statement includes: Scan each database statement in the target database log of the target project; Parsing each database statement to obtain the query conditions and query results in the corresponding query statement; Use regular matching to match the query conditions and query results of each database statement to obtain matching results; Generate a database join query statement based on the table name, field and value information in the matching result.
4. The artificial intelligence-based data query method according to claim 1, wherein: The step of analyzing the database join query statement based on the table structure information of the target project to obtain the main table and the sub-tables, as well as the corresponding relationship between the main table and the sub-tables includes: Analyze the database query statements and filter out data tables with associated relationships; Identify the connection method of data tables with associated relationships; When the connection mode of the data tables with the associated relationship is a left join, determining that the left table in the data tables with the associated relationship is a main table and the right table is a sub-table, and identifying whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, determining that the corresponding relationship between the main table and the sub-table is a preset first corresponding relationship; When the connection mode of the data tables with an associated relationship is a right join, it is determined that the right table in the data tables with an associated relationship is the main table and the left table is the sub-table, and it is identified whether the main table and the sub-table are consistent with the corresponding main table and sub-table in the table structure information of the target project; when the main table and the sub-table are completely consistent with the corresponding main table and sub-table in the table structure information, the corresponding relationship between the main table and the sub-table is a preset second corresponding relationship.
5. The artificial intelligence-based data query method according to claim 4, characterized in that: The method further comprises: When the connection mode of the data tables with the association relationship is inner connection, obtaining the table names of the two tables with inner connection; Traversing the table structure information based on the table names of the two tables to obtain a traversal result; When the two corresponding tables in the traversal result are in a one-to-one relationship, determining that the corresponding relationship between the two tables in the data table with an associated relationship is a preset third corresponding relationship; When the two corresponding tables in the traversal result are not in a one-to-one relationship, the connection mode of the data tables with the associated relationship is updated based on the traversal result.
6. The artificial intelligence-based data query method according to claim 1, characterized in that: The creating a first entity relationship diagram based on the configuration information of the target project and the correspondence between the main table and the sub-tables includes: Obtaining the target entity to be displayed from the configuration information of the target project; Extracting the target entity to be displayed from the corresponding relationship; Extracting features corresponding to the target entity from the corresponding relationship as attributes; Extracting the relationship and relationship cardinality between the target entities from the corresponding relationship; A first entity relationship diagram is generated according to the target entity, the attributes, the relationships and the relationship cardinality using a preset entity relationship diagram generation tool.
7. The artificial intelligence-based data query method according to any one of claims 1 to 6, characterized in that: After obtaining the second entity relationship diagram, the method further includes: Identify a type of relationship schema in the second entity-relationship diagram; Obtaining the conversion rules corresponding to the relational schema type; The second entity relationship diagram is mapped into a relationship table using the conversion rule.
8. A data query device based on artificial intelligence, characterized in that: The device comprises: The parsing and obtaining module is used to parse the received data table relationship query request, obtain the target project and the target database log of the target project, and the table relationship query condition; A scanning module, configured to scan database statements in a target database log of the target project to obtain database join query statements; An analysis module, configured to analyze the database join query statement based on the table structure information of the target project to obtain a main table and sub-tables, as well as a corresponding relationship between the main table and the sub-tables; A creation module, configured to create a first entity relationship diagram based on the configuration information of the target project and the corresponding relationship between the main table and the sub-tables; a verification module for verifying the first entity relationship diagram to obtain a second entity relationship diagram, comprising: randomly extracting a log to be verified from the target database log; scanning database statements in the log to be verified to obtain a database join query statement corresponding to the log to be verified; analyzing the database join query statement corresponding to the log to be verified based on the table structure information of the target project to obtain a main table to be verified and a sub-table to be verified, as well as a correspondence between the main table to be verified and the sub-table to be verified; judging whether the main table to be verified and the sub-table to be verified are consistent with the main table and the sub-table corresponding to the first entity relationship diagram; when the main table to be verified and the sub-table to be verified are consistent with the main table and the sub-table corresponding to the first entity relationship diagram, determining the first entity relationship diagram as the second entity relationship diagram; when the main table to be verified and the sub-table to be verified are not consistent with the main table and the sub-table corresponding to the first entity relationship diagram, verifying the first entity relationship diagram according to a preset verification rule to obtain a verification result, and updating the first entity relationship diagram based on the verification result to obtain a second entity relationship diagram; A query module is used to perform a table relationship query in the second entity relationship diagram according to the table relationship query condition to obtain a query result.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is used to implement the artificial intelligence-based data query method as described in any one of claims 1 to 7 when executing the computer program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the artificial intelligence-based data query method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
A graph data construction method and device and a graph data query method and device
CN113704486A
Automatic maintenance method and device for database entity relationship and computer readable medium
CN114328758A