CN112015722A - Database management method, data blood relationship analysis method and related device - Google Patents

Database management method, data blood relationship analysis method and related device Download PDF

Info

Publication number
CN112015722A
CN112015722A CN202011200865.4A CN202011200865A CN112015722A CN 112015722 A CN112015722 A CN 112015722A CN 202011200865 A CN202011200865 A CN 202011200865A CN 112015722 A CN112015722 A CN 112015722A
Authority
CN
China
Prior art keywords
task
executed
structure information
database
structured query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011200865.4A
Other languages
Chinese (zh)
Inventor
陶程飞
何林强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202011200865.4A priority Critical patent/CN112015722A/en
Publication of CN112015722A publication Critical patent/CN112015722A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models

Abstract

The application discloses a database management method, a data blood relationship analysis method and a related device, wherein the management method comprises the following steps: generating a task to be executed of a database, wherein the task to be executed is generated by a Structured Query Language (SQL); analyzing a structured query language corresponding to a task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information; and in response to the table structure of the database being changed by the task to be executed, obtaining the table structure information changed by the task to be executed, and synchronously updating the table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating. Through the mode, the changed table structure information can be synchronously sent to the table detail management module, so that the problem that the database is frequently inquired due to the fact that the table detail management module is not updated timely is solved, and the performance of the database is improved.

Description

Database management method, data blood relationship analysis method and related device
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a database management method, a data blood relationship analysis method, and a related apparatus.
Background
The table detail management module in the existing database cannot acquire the table structure information created by Structured Query Language (SQL), so when the table structure information created by the SQL is needed to be used, the table structure information created by the SQL can only be acquired by querying the database, and frequent querying of the database affects the performance of database connection, querying and the like.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a database management method, a data blood relationship analysis method and a related device, which can synchronize changed table structure information to a table detail management module so as to avoid the problem of frequent database query caused by the fact that the table detail management module does not update the table structure information in time and improve the performance of a database.
To solve the above technical problem, a first aspect of the present application provides a database management method, including: generating a task to be executed of a database, wherein the task to be executed is generated by a Structured Query Language (SQL); analyzing a structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information; and in response to the table structure of the database being changed by the task to be executed, obtaining the table structure information changed by the task to be executed, and synchronously updating a table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating.
The task to be executed includes at least one of a table creation task, a table deletion task, a table modification task and a blood margin generation task, and before the step of generating the task to be executed of the database, the method further includes: a corresponding statement type is created for each type of task, and the statement types corresponding to each type of task may be parsed into the same structural form.
Wherein, before the step of analyzing the structured query language corresponding to the task to be executed, the method comprises the following steps: carrying out grammar check on the structured query language corresponding to the task to be executed; and in response to that the structured query language corresponding to the task to be executed does not accord with the preset grammar rule, identifying and prompting the position of the structured query language which does not accord with the preset grammar rule.
The step of analyzing the structured query language corresponding to the task to be executed to obtain the data structure information corresponding to the structured query language includes: obtaining a structured query language corresponding to the task to be executed; and analyzing the structured query language, and extracting the data structure information corresponding to the structured query language according to the structure form.
Wherein said updating table details management module synchronously using said changed table structure information comprises: sensing the statement type; and responding to the perception of the statement type corresponding to the table creating task, the statement type corresponding to the table deleting task and the statement type corresponding to the table modifying task, acquiring the table structure information in the data structure information and synchronizing the table structure information to the table detail management module.
In order to solve the above technical problem, a second aspect of the present application provides a data blood relationship analysis method, including: generating a task to be executed of a database, wherein the task to be executed is generated by a Structured Query Language (SQL); analyzing a structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information; in response to the table structure of the database being changed by the task to be executed, obtaining table structure information changed by the task to be executed, and synchronously updating a table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating; in response to the fact that the blood relationship information of the database is changed by the task to be executed, obtaining the blood relationship information changed by the task to be executed, and updating the whole blood relationship information of the database by using the changed blood relationship information and the updated table detail management module.
The task to be executed includes at least one of a table creation task, a table deletion task, a table modification task and a blood margin generation task, and before the step of generating the task to be executed of the database, the method further includes: a corresponding statement type is created for each type of task, and the statement types corresponding to each type of task may be parsed into the same structural form.
Wherein the updating of the entire consanguinity information of the database with the changed consanguinity information and the updated table detail management module comprises: sensing the statement type; responding to the statement type corresponding to the blood margin generating task, and acquiring data structure information corresponding to the blood margin generating task; generating a blood relationship between a source table and a target table corresponding to the blood margin generating task by using table structure information in data structure information corresponding to the blood margin generating task; acquiring the updated table detail management module and generating a complete blood relationship graph corresponding to the current database by combining the blood relationship generated by the blood relationship generation task; and storing the complete blood relationship graph corresponding to the current database into a graphic database.
In order to solve the above technical problem, a third aspect of the present application provides an electronic device, which includes a memory and a processor coupled to each other, wherein the memory stores program data, and the processor calls the program data to execute the database management method of the first aspect or the data blood-source analysis method of the second aspect.
In order to solve the above technical problem, a fourth aspect of the present application provides a computer storage medium having stored thereon program data that, when executed by a processor, implements the database management method of the first aspect or the data consanguinity analysis method of the second aspect.
The beneficial effect of this application is: the method comprises the steps of analyzing a structured query language corresponding to a task to be executed, extracting data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information, and after the table structure information changed by the task to be executed is obtained, synchronously updating a table detail management module by using the changed table structure information, so that the table detail management module updates the table structure information in time after the table structure of the database is changed by the task to be executed generated by the structured query language, the problem that the database is frequently queried due to the fact that the table detail management module does not update the table structure information in time is solved, and the performance of the database is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
FIG. 1 is a schematic flow chart diagram illustrating one embodiment of a database management method provided herein;
FIG. 2 is a schematic flow chart diagram illustrating another embodiment of a database management method provided herein;
FIG. 3 is a diagram illustrating a structure of an embodiment corresponding to table structure information obtained after parsing of a create table task;
FIG. 4 is a schematic flow chart diagram illustrating an embodiment of a data blood margin analysis method provided herein;
FIG. 5 is a schematic structural diagram of an embodiment of table structure information obtained after parsing of the blood margin generation task;
FIG. 6 is a flowchart illustrating an embodiment corresponding to step S404 in FIG. 4;
FIG. 7 is a schematic structural diagram of an embodiment of an electronic device provided in the present application;
FIG. 8 is a schematic structural diagram of an embodiment of a computer storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, the term "plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a database management method provided in the present application, the method including:
step S101: and generating a task to be executed of the database, wherein the task to be executed is generated by a structured query language.
Specifically, the structured query language is a database language having multiple functions of data manipulation and data definition, wherein the tasks to be executed are generated by the structured query language and submitted from a client to a server.
Further, the structured query language may be Hive-SQL. The Hive is an application tool based on a data warehouse, is used for processing structured data in Hadoop, is constructed on the Hadoop, and operates the data through SQL. To achieve the technical purpose of the present application, the present application makes a corresponding improvement on a structured query language.
Specifically, the syntax file is reconstructed based on an Antlr3 syntax file native to Hive, and is modified into an Antlr4 syntax file of a new version, wherein the Antlr4 is used for analyzing the morphology and the syntax and is all called Another Tool for Language Recognition in English.
Further, the application defines a data structure corresponding to the Hive grammar rule, is compatible with the Hive native SQL grammar and generates an Antlr4 grammar file. The reconstructed Antlr4 grammar file is completely compatible with the Hive native grammar rule, and compared with the Hive native parsing module, a visitor and listener mode is introduced, so that parsing is separated from application codes.
Step S102: analyzing the structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information.
Specifically, the structured query language corresponding to the task to be executed is analyzed through the analysis module, and then data structure information corresponding to the structured query language is obtained.
In an application mode, a client performs lexical and syntactic analysis on a structured query language by using an Antlr4 grammar file to obtain a source code of the structured query language, sequentially reads in a character stream of the source code, identifies morphemes in the character stream, maps the morphemes into tags after obtaining the morphemes, one tag corresponds to one type in grammar of the structured query language, further performs syntactic analysis on all tags, combines all tags to generate an abstract syntax tree, and passes through nodes of the abstract syntax tree to obtain data structure information corresponding to the structured query language. The data structure information includes table structure information, such as table name, field name, and field content.
Step S103: and in response to the table structure of the database being changed by the task to be executed, obtaining the table structure information changed by the task to be executed, and synchronously updating the table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating.
Specifically, the table detail management module stores the table structure information of the database before the to-be-executed task is not executed, and when the table structure of the database is changed by the to-be-executed task, the table structure information changed by the to-be-executed task analyzed in the step S102 is acquired, and the changed table structure information is synchronized to the table detail management module, so that the table detail management module acquires and updates the table structure information of the entire database in real time. When the table structure information created by the structured query language is needed to be used, the table structure information of the whole database can be obtained from the table detail management module, the whole database does not need to be frequently queried, and the performance of the database in the aspects of connection, query and the like is improved.
In this embodiment, a structured query language corresponding to a task to be executed is analyzed, and data structure information corresponding to the structured query language is extracted, where the data structure information includes table structure information, and after the table structure information changed by the task to be executed is obtained, the table detail management module is updated synchronously by using the changed table structure information, so that after a table structure of a database is changed by the task to be executed generated by the structured query language, the table detail management module updates the table structure information in time, thereby avoiding a problem that the database is frequently queried because the table detail management module does not update the table structure information in time, and improving performance of the database.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another embodiment of a database management method provided in the present application, the method including:
step S201: a corresponding statement type is created for each type of task.
Specifically, the tasks to be executed include at least one of a table creation task, a table deletion task and a table modification task, each task corresponds to one task purpose, respective statement types are created for different purpose tasks, the tasks of different purposes are distinguished through different statement types, and finally the statement types corresponding to each type of task can be analyzed into the same structural form and temporarily stored in a storage space provided in the statement types.
Specifically, among the different types of tasks to be executed, the table creating task, the table deleting task and the table modifying task belong to tasks which can affect the table structure, and because the different types of tasks are provided with corresponding statement types, the task type can be known by sensing the statement type, and further, what effect the task has on the database can be known according to the task type.
Step S202: and generating a task to be executed of the database, wherein the task to be executed is generated by a Structured Query Language (SQL).
Specifically, the to-be-executed tasks of the database are generated by inputting codes which conform to the grammar rules of the structured query language, the to-be-executed tasks can contain one or more types of tasks, the same type of tasks can be set to be multiple, and the to-be-executed tasks are generated and uploaded to the server side by the client side.
In a specific application scenario, a code of a structured query language corresponding to a table creation task is: createtableables 1(column1 int, column2 string); wherein table1 is a table name, column1 and column2 are fields in table 1.
Further, before parsing the structured query language corresponding to the task to be executed, the method further includes: carrying out grammar check on a structured query language corresponding to a task to be executed; and in response to that the structured query language corresponding to the task to be executed does not accord with the preset grammar rule, identifying and prompting the position of the structured query language which does not accord with the preset grammar rule.
Specifically, the data structure corresponding to the Hive grammar rule is defined, and the Hive native grammar rule is completely compatible, so when the input codes do not accord with the Hive native grammar rule, errors can be reported when the structured query language is analyzed, when the analysis is not passed, the positions of grammar errors can be identified according to the prompt of a grammar file, developers are assisted to position and modify grammar problems, the probability of database collapse caused by executing the codes which do not accord with the grammar rule is further reduced, and the safety of the database is improved.
Step S203: analyzing the structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information.
Specifically, the client obtains the structured query language corresponding to the task to be executed through the parsing module, and further parses the structured query language, and extracts the data structure information corresponding to the structured query language according to the structural form.
Specifically, different types of tasks correspond to respective statement types, the client senses the statement types through keywords of the statement types, analyzes the structured query statements corresponding to the different types of tasks respectively, and extracts corresponding data structure information.
In a specific application scenario, the code of the structured query language corresponding to the create table task is: a createtable table1(column1 int, column2 string). The code of the structured query language corresponding to the table creation task is analyzed, and finally, the data structure information arranged in the structural form as shown in fig. 3 can be obtained. The createtablestatus is a statement type corresponding to the result of the task analysis of the created table, tableInfo in the createtablestatus is table information, columninfo is a field set, and selectState is a source table query statement. The selectStatement is a source table query statement, columnInfo in the selectStatement is a source table field set, fromTableInfo is a source table set, and a source table may be associated with multiple tables. TableInfo is table information, and contains a databaseName database name and a tableName table name. ColumnInfo is field information, and the ColumnInfo contains a tableName table name and a columnName field name. Furthermore, for a particular statement that specifies a source table query statement, such as the create table … as …, the value of the source table query statement is not null.
It can be understood that, after parsing the delete table task and the modify table task, parsing may be performed to obtain parsing results with statement types of deletetablestatems and alternatetestatems, where the parsing results may also include information related to the table structure, such as the table name and the field name. Therefore, after the analysis of the analysis module, the structured query statement corresponding to each type of task can be analyzed into a data entity in a fixed structure form, and the data entity comprises complete information of the statement.
Further, before step S204, after the server successfully executes the task to be executed, the server feeds back a result of the successful execution to the client and sends the number of data affected by the task to be executed, and the client receives the result fed back by the server and the number of data affected by the task to be executed. Step S204 is only performed if the execution result is successful, and the process is terminated if the execution result is failed, so as to avoid the information mismatch between the client and the server.
Step S204: and in response to the table structure of the database being changed by the task to be executed, obtaining the table structure information changed by the task to be executed, and synchronously updating the table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating.
Specifically, the client searches and senses the statement type corresponding to the analysis result to know whether the table structure of the database is changed by the structured query language, responds to sensing the statement type corresponding to the table creating task/the statement type corresponding to the table deleting task/the statement type corresponding to the table modifying task, acquires the table structure information in the data structure information, and synchronizes to the table detail management module.
Specifically, if the statement type corresponding to the table creation task is sensed, adding database name, table name and field name information in the data structure information corresponding to the table creation task to the table detail management module; and/or deleting the table name in the data structure information corresponding to the table deleting task from the table detail management module if the statement type corresponding to the table deleting task is sensed; and/or, if the statement type corresponding to the table modification task is sensed, table name renaming, field renaming and field details in the data structure information corresponding to the table modification task are updated to the table detail management module.
In a specific application scenario, if the statement type is a statement type corresponding to a table creating task, table structure information in CreateTableStatement is acquired, and database name, table name and field name information are synchronously modified to a table detail management module to realize table creating information synchronization; if the statement type is the statement type corresponding to the table deleting task, acquiring table structure information in DeleteTableStatement, and synchronizing the table name to the table detail management module for deleting operation to realize the synchronization of the deleted table information; if the statement type is the statement type corresponding to the modification table task, the table structure information in the alternate table context is obtained, the table name is renamed, the field is added with or deleted with details, and the modification information is synchronized to the table detail management module, so that the synchronization of the modification table structure information is realized.
Referring to fig. 4, fig. 4 is a schematic flow chart of an embodiment of a data blood relationship analysis method provided in the present application, the method including:
step S401: and generating a task to be executed of the database, wherein the task to be executed is generated by a structured query language.
Step S402: analyzing the structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information.
Step S403: and in response to the table structure of the database being changed by the task to be executed, obtaining the table structure information changed by the task to be executed, and synchronously updating the table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating.
Specifically, the steps S401 to S403 are similar to the embodiments described above, and reference may be made to any of the embodiments described above, which are not described herein again.
Further, the task to be executed includes at least one of a table creation task, a table deletion task, a table modification task and a blood margin generation task, and before the step of generating the task to be executed of the database, the method further includes: a corresponding statement type is created for each type of task, and the statement types corresponding to each type of task can be resolved into the same structural form.
Specifically, each task corresponds to one task purpose, respective statement types are created for tasks with different purposes, the tasks with different purposes are distinguished through different statement types, and finally the statement types corresponding to the tasks with each type can be analyzed into the same structural form and temporarily stored in a storage space provided in the statement types. The blood relationship is influenced by the blood relationship generation task, and the task type can be known by sensing the sentence type due to the fact that the tasks of different types are provided with the corresponding sentence types, and further the influence of the tasks on the database can be known according to the task type.
In a specific application scenario, the code of the structured query language corresponding to the blood-related generation task is: insert into dest1(column3, column4) select column1, column2 from src 1. Where dest1 is the destination table name and src1 is the source table name, data can be added directly to a table or partition of a table via an insert _ intro statement. The code of the structured query language corresponding to the blood-related generation task is analyzed, and finally, the data structure information arranged in the structural form as shown in fig. 5 can be obtained. The method includes the steps that an insertStation is a statement type corresponding to a blood-related generation task analysis result, override in the insertStation is whether to contain override keywords, the insert override statement is different from an insert inter statement, original data in a table are cleared by the insert override statement first, and then the data are inserted into the table or a partition of the table, so that whether the override keywords are contained or not needs to be judged during analysis.
Further, tableInfo in InsertStatement is destination table information, columninfo is a destination field set, and selectStatement is a source table query statement. The SelectStatement is a source table query statement, columninfo in the SelectStatement is a source table field set, fromTableInfo is a source table set, and a source table may be associated with multiple tables. TableInfo is table information, and contains a databaseName database name and a tableName table name. ColumnInfo is field information, and the ColumnInfo contains a tableName table name and a columnName field name. Furthermore, for a particular statement that specifies a source table query statement, such as the create table … as …, the value of the source table query statement is not null.
Step S404: and in response to the blood relationship information of the database being changed by the task to be executed, obtaining the blood relationship information changed by the task to be executed, and updating the whole blood relationship information of the database by using the changed blood relationship information and the updated table detail management module.
Specifically, when the task to be executed includes a blood margin generation task, a source table name, a source table field name, a destination table name and a destination table field name in data structure information corresponding to the blood margin generation task are obtained, a table level blood margin relationship is generated according to the sequence of the source table name and the destination table name, and a field level blood margin relationship is generated according to the sequence of the source table field name and the destination table field name.
Further, when the table structure of the database changes due to the table creating task, the table deleting task, and the table modifying task, in addition to the blood relationship corresponding to the blood relationship generating task, the blood relationship of the entire database is updated in combination with the number of data affected by the task to be executed fed back by the server and the data structure information corresponding to the structured query language obtained in step S402, and the blood relationship can help to comb the mapping relationship between the tables and the fields in the database, so that the flow direction of data can be tracked in a large amount of data, and the data can be managed more conveniently.
In an application manner, please refer to fig. 6, fig. 6 is a flowchart illustrating an embodiment corresponding to step S404 in fig. 4, where step S404 specifically includes:
step S601: the statement type is perceived.
Specifically, the client searches and senses the statement type corresponding to the analysis result to know whether the blood margin generation task affects the table in the database.
Step S602: and responding to the statement type corresponding to the blood margin generation task, and acquiring data structure information corresponding to the blood margin generation task.
Specifically, if the statement type corresponding to the blood margin generation task is sensed, the source table name, the source table field name, the destination table name and the destination table field name in the data structure information corresponding to the blood margin generation task are extracted.
In a specific application scenario, when a blood-related task is sensed, a source table name, a source table field name, a destination table name and a destination table field name in the InsertStament are extracted.
Step S603: and generating a blood relationship between the source table and the target table corresponding to the blood margin generating task by using the table structure information in the data structure information corresponding to the blood margin generating task.
Specifically, the table-to-table blooding relationships are generated according to the order of the source table name and the destination table name, and the bloody relationships between the fields are generated according to the order of the source table field name and the destination table field name.
In a specific application scenario, for a code: insert into dest1(column3, column4) select column1, column2 from src 1. The table name of dest1 and the table name of src1 are in a blood relationship, the field name of dest1 and the field name of src1 are in a blood relationship, wherein in the blood relationship of the fields, column3 corresponds to column1, and column4 corresponds to column 2.
In another specific application scenario, for a code: insert into dest1 select column1, column2 from src1, destination table field not specified. Defining unknown fields of a destination table, namely unknown1 and unknown2, establishing a blood relationship between the table name of dest1 and the table name of src1, and establishing a blood relationship between the field name of dest1 and the field name of src1, wherein in the blood relationship of the fields, unknown1 corresponds to column1, and unknown2 corresponds to column 2.
Step S604: and obtaining the updated table detail management module and combining the blood relationship generated by the blood relationship generation task to generate a complete blood relationship graph corresponding to the current database.
Specifically, the table structure of the database is updated in the table detail management module in time, and a complete blood relationship graph corresponding to the current whole database is generated by combining the table structure information in the updated table detail management module and the blood relationship generated by the blood relationship generation task.
Furthermore, when the blood relationship graph of the whole database is updated, the table name containing the unknown field in the blood relationship is identified, the client only needs to obtain the table structure information from the table detail management module, the database does not need to be queried when the table structure information created by the structured query language is involved, and the frequency of accessing and querying the database is reduced.
Step S605: and storing the complete blood relationship graph corresponding to the current database into the graphic database.
Specifically, the graphic database is a Neo4j graph database, and the complete blood relationship graph corresponding to the current database is stored in the graphic database, so that the blood relationship graph can be updated in real time and visualized, and the blood relationship graph is more intuitive and more convenient to use.
The data blood relationship analysis method provided by this embodiment creates corresponding statement types for different types of tasks, and updates the analyzed results of the different types of tasks to the table detail management module in real time, so that when a blood relationship needs to be generated, accurate table structure information in the current database can be obtained by querying the table detail management module, thereby reducing the number of times for querying the database, and updating the complete blood relationship diagram of the current database in real time, so as to improve the efficiency of data management.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of an electronic device 70 provided in the present application, where the electronic device 70 includes a memory 701 and a processor 702 coupled to each other, where the memory 701 stores program data (not shown), and the processor 702 calls the program data to implement a database management method or a data blood-related analysis method in any of the above embodiments.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of a computer storage medium 80 provided in the present application, the computer storage medium 80 stores program data 800, and the program data 800, when executed by a processor, implements a database management method or a data margin analysis method in any of the embodiments described above, and for a description of relevant contents, reference is made to the detailed description of the embodiments of the methods described above, which is not repeated herein.
It should be noted that, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A database management method, the method comprising:
generating a task to be executed of a database, wherein the task to be executed is generated by a Structured Query Language (SQL);
analyzing a structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information;
and in response to the table structure of the database being changed by the task to be executed, obtaining the table structure information changed by the task to be executed, and synchronously updating a table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating.
2. The method of claim 1,
the task to be executed comprises at least one of a table creation task, a table deletion task and a table modification task, and before the step of generating the task to be executed of the database, the method further comprises the following steps:
a corresponding statement type is created for each type of task, and the statement types corresponding to each type of task may be parsed into the same structural form.
3. The method according to claim 1, wherein the step of parsing the structured query language corresponding to the task to be executed is preceded by:
carrying out grammar check on the structured query language corresponding to the task to be executed;
and in response to that the structured query language corresponding to the task to be executed does not accord with the preset grammar rule, identifying and prompting the position of the structured query language which does not accord with the preset grammar rule.
4. The method according to claim 2, wherein the step of parsing the structured query language corresponding to the task to be executed to obtain the data structure information corresponding to the structured query language includes:
obtaining a structured query language corresponding to the task to be executed;
and analyzing the structured query language, and extracting the data structure information corresponding to the structured query language according to the structure form.
5. The method according to claim 2, wherein said updating table detail management module synchronously with said changed table structure information comprises:
sensing the statement type;
and responding to the perception of the statement type corresponding to the table creating task, the statement type corresponding to the table deleting task and the statement type corresponding to the table modifying task, acquiring the table structure information in the data structure information and synchronizing the table structure information to the table detail management module.
6. A method of data blood margin analysis, the method comprising:
generating a task to be executed of a database, wherein the task to be executed is generated by a Structured Query Language (SQL);
analyzing a structured query language corresponding to the task to be executed to obtain data structure information corresponding to the structured query language, wherein the data structure information comprises table structure information;
in response to the table structure of the database being changed by the task to be executed, obtaining table structure information changed by the task to be executed, and synchronously updating a table detail management module by using the changed table structure information, wherein the table detail management module stores the table structure information corresponding to the database before updating;
in response to the fact that the blood relationship information of the database is changed by the task to be executed, obtaining the blood relationship information changed by the task to be executed, and updating the whole blood relationship information of the database by using the changed blood relationship information and the updated table detail management module.
7. The method of claim 6,
the task to be executed comprises at least one of a table creation task, a table deletion task, a table modification task and a blood margin generation task, and before the step of generating the task to be executed of the database, the method further comprises the following steps:
a corresponding statement type is created for each type of task, and the statement types corresponding to each type of task may be parsed into the same structural form.
8. The method of claim 7, wherein said updating the entire consanguinity information of the database with the changed consanguinity information and the updated table detail management module comprises:
sensing the statement type;
responding to the statement type corresponding to the blood margin generating task, and acquiring data structure information corresponding to the blood margin generating task;
generating a blood relationship between a source table and a target table corresponding to the blood margin generating task by using table structure information in data structure information corresponding to the blood margin generating task;
acquiring the updated table detail management module and generating a complete blood relationship graph corresponding to the current database by combining the blood relationship generated by the blood relationship generation task;
and storing the complete blood relationship graph corresponding to the current database into a graphic database.
9. An electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program data that the processor calls to perform the method of any of claims 1-5 or 6-8.
10. A computer storage medium having program data stored thereon, wherein the program data, when executed by a processor, implements the method of any of claims 1-5 or 6-8.
CN202011200865.4A 2020-11-02 2020-11-02 Database management method, data blood relationship analysis method and related device Pending CN112015722A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011200865.4A CN112015722A (en) 2020-11-02 2020-11-02 Database management method, data blood relationship analysis method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011200865.4A CN112015722A (en) 2020-11-02 2020-11-02 Database management method, data blood relationship analysis method and related device

Publications (1)

Publication Number Publication Date
CN112015722A true CN112015722A (en) 2020-12-01

Family

ID=73527505

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011200865.4A Pending CN112015722A (en) 2020-11-02 2020-11-02 Database management method, data blood relationship analysis method and related device

Country Status (1)

Country Link
CN (1) CN112015722A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204558A (en) * 2021-05-25 2021-08-03 城云科技(中国)有限公司 Method and device for automatically updating data table structure
CN113535352A (en) * 2021-06-28 2021-10-22 四川新网银行股份有限公司 Testing method for generating blood relationship based on scheduling configuration to realize automatic batch running
CN114428822A (en) * 2022-01-27 2022-05-03 云启智慧科技有限公司 Data processing method and device, electronic equipment and storage medium
WO2022116425A1 (en) * 2020-12-03 2022-06-09 平安科技(深圳)有限公司 Method and system for data lineage analysis, computer device, and storage medium
CN116932656A (en) * 2023-09-18 2023-10-24 中孚安全技术有限公司 Data blood edge storage method, system, equipment and medium based on block chain

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022116425A1 (en) * 2020-12-03 2022-06-09 平安科技(深圳)有限公司 Method and system for data lineage analysis, computer device, and storage medium
CN113204558A (en) * 2021-05-25 2021-08-03 城云科技(中国)有限公司 Method and device for automatically updating data table structure
CN113535352A (en) * 2021-06-28 2021-10-22 四川新网银行股份有限公司 Testing method for generating blood relationship based on scheduling configuration to realize automatic batch running
CN113535352B (en) * 2021-06-28 2023-06-06 四川新网银行股份有限公司 Test method for realizing automatic batch running based on blood relationship generated by scheduling configuration
CN114428822A (en) * 2022-01-27 2022-05-03 云启智慧科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114428822B (en) * 2022-01-27 2022-07-29 云启智慧科技有限公司 Data processing method and device, electronic equipment and storage medium
CN116932656A (en) * 2023-09-18 2023-10-24 中孚安全技术有限公司 Data blood edge storage method, system, equipment and medium based on block chain
CN116932656B (en) * 2023-09-18 2024-01-09 中孚安全技术有限公司 Data blood edge storage method, system, equipment and medium based on block chain

Similar Documents

Publication Publication Date Title
CN110908997B (en) Data blood relationship construction method and device, server and readable storage medium
CN112015722A (en) Database management method, data blood relationship analysis method and related device
US20180357055A1 (en) System and method for computer language migration
US9514188B2 (en) Integrating map-reduce into a distributed relational database
CN105868204B (en) A kind of method and device for converting Oracle scripting language SQL
US9430494B2 (en) Spatial data cartridge for event processing systems
US10162613B1 (en) Re-usable rule parser for different runtime engines
US7822710B1 (en) System and method for data collection
CN109426725B (en) Data desensitization method, device and computer readable storage medium
US9626368B2 (en) Document merge based on knowledge of document schema
EP3671526B1 (en) Dependency graph based natural language processing
US9805137B2 (en) Virtualizing schema relations over a single database relation
WO2019017997A1 (en) Distributed graph database writes
CN112235311B (en) OVSDB client code automatic generation method, system, device and medium
US9053207B2 (en) Adaptive query expression builder for an on-demand data service
CN112434046A (en) Data blood margin analysis method, device, equipment and storage medium
CN114676678A (en) Structured query language data parsing method and device and electronic equipment
US20190311065A1 (en) Text searches on graph data
CN111737228B (en) Database and table dividing method and device
CN108694172B (en) Information output method and device
WO2020024778A1 (en) Method, system and device for modifying xml file in batch and computer-readable storage medium
CN111460000A (en) Backtracking data query method and system based on relational database
CN110147396B (en) Mapping relation generation method and device
CN111078728A (en) Cross-database query method and device in database filing mode
CN112765180B (en) Method and device for analyzing column names of table building logs of DB2 database

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination