WO2023097521A1 - 数据模型生成的方法和装置 - Google Patents
数据模型生成的方法和装置 Download PDFInfo
- Publication number
- WO2023097521A1 WO2023097521A1 PCT/CN2021/134650 CN2021134650W WO2023097521A1 WO 2023097521 A1 WO2023097521 A1 WO 2023097521A1 CN 2021134650 W CN2021134650 W CN 2021134650W WO 2023097521 A1 WO2023097521 A1 WO 2023097521A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- data
- identifier
- database
- statement
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/211—Schema design and management
- G06F16/212—Schema design and management with details for data modelling support
Definitions
- the present application relates to the field of database technology, and more specifically, to a method and device for generating a data model.
- the present application provides a method and device for generating a data model, which can generate a data model closely related to a target business with high accuracy and efficiency, so that an enterprise can conduct independent research and development based on the generated data model.
- a method for generating a data model including: acquiring a data access statement sent from a client to a database, the data access statement being used to access data of a target business in the database; according to the data access statement Obtaining the identification of each target table in at least one target table in the database called by the target service and the identification of the target column in the target table; according to the identification of the target table and the organization of the tables in the database and structure, determine the data type of the target column; determine the data model of the database according to the identifier of the target table, the identifier of the target column, and the data type.
- the data access statement related to the user's operation will be sent from the user end to the database. Therefore, the data access statement obtained by the above technical solution is closely related to the target business accessed by the user, and the data model generated based on the data access statement is also closely related to the target business accessed by the user, which can effectively avoid the problem of generating a large number of invalid data models . Further, the above technical solution does not rely on manual experience, effectively improving the efficiency and accuracy of data model generation.
- the obtaining the data access statement sent by the client to the database includes: filtering a plurality of pieces of information generated based on the target service to obtain the data access statement, wherein the multiple This information includes the data access statement.
- a plurality of pieces of information can be generated based on the target service, and the pieces of information include other information besides the data access statement.
- the above technical solution filters the multiple information to filter out information other than data access statements in the multiple information, so that the remaining information is data access statements closely related to the target business, thereby further avoiding the generation of Lots of problems with invalid data models.
- acquiring the identifier of each target table in at least one target table in the database called by the target service and the identifier of the target column in the target table comprising: when the data access statement is a query statement, extracting a first character string between a secondary keyword and a conditional keyword in the query statement, where the first character string is an identifier of the target table; Extracting a second character string between the selection key and the secondary key in the query statement, where the second character string is an identifier of the target column.
- the method further includes: obtaining the multiple target tables according to the join query statement The relationship of the table on the target business; said determining the data model of the database according to the identification of the target table, the identification of the target column, and the data type includes: according to the identification of the target table, The identifier of the target column, the relationship of the multiple target tables on the target service, and the data type determine the data model.
- the structural information in the data access statement is used to analyze the potential relationship between tables, and a data model is generated according to the relationship. Since the above technical solution does not depend on the reference foreign key in the schema in the database, it avoids the disadvantages of the generated data model being inaccurate or even unable to generate the data model relationship due to the absence of the reference foreign key in the schema in the database, which further improves the generated data. model accuracy.
- the obtaining the relationship of the multiple target tables on the target business according to the connection query statement includes: following the condition keyword in the connection query statement In the third character string, the relationship between the multiple target tables on the target business is acquired.
- acquiring the identifier of each target table in at least one target table in the database called by the target service and the identifier of the target column in the target table comprising: when the data access statement is an insert statement, extracting a fourth character string between an insert keyword and a value keyword in the insert statement, where the fourth character string is an identifier of the target table; Extracting a fifth character string in brackets after the value keyword in the insert statement, where the fifth character string is an identifier of the target column.
- the method further includes: aggregating the identifier of the target table and the identifier of the target column;
- the data type, determining the data model of the database includes: determining the data model based on the aggregated identifier of the target table and the identifier of the target column, and based on the data type.
- the above technical solution before generating the data model, aggregates the identification of the target table and the identification of the target column. Compared with the identification of the target table and the identification of the target column in a discrete state, it is convenient for subsequent operations and is conducive to improving the efficiency of data model generation. efficiency.
- a device for generating a data model including: a memory for storing a program; a processor for executing the program stored in the memory, and when the program stored in the memory is executed, the processing
- the device is configured to execute the method in the above first aspect or its various implementation manners.
- a computer-readable storage medium which stores program codes for device execution, where the program codes include instructions for executing the steps in the methods of the above-mentioned first aspect or various implementations thereof.
- a device for generating a data model including: a preprocessor, configured to acquire a data access statement sent from a client to a database, and the data access statement is used to access data of a target service in the database; An analyzer, configured to obtain the identifier of each target table in at least one target table in the database called by the target service and the identifier of the target column in the target table according to the data access statement; the model generator, It is used to determine the data type of the target column according to the identification of the target table and the organization and structure of the table in the database; the model generator is also used to determine the target column according to the identification of the target table and the target column The identifier and the data type determine the data model of the database.
- an apparatus for generating a data model including units configured to execute the method in the above first aspect or various implementations thereof.
- FIG. 1 is a schematic diagram of a system architecture according to an embodiment of the present application.
- Fig. 2 is a schematic diagram of a method for generating a data model according to an embodiment of the present application.
- FIG. 3 is a flow chart of a method for generating a data model according to an embodiment of the present application.
- FIG. 4 is a flowchart of another method for generating a data model according to an embodiment of the present application.
- Fig. 5 is a schematic block diagram of an apparatus for generating a data model according to an embodiment of the present application.
- Fig. 6 is a schematic block diagram of another apparatus for generating a data model according to an embodiment of the present application.
- Fig. 7 is a schematic block diagram of another device for generating a data model according to an embodiment of the present application.
- sequence numbers of the processes do not mean the order of execution, and the execution order of the processes should be determined by their functions and internal logic, rather than by the execution order of the embodiments of the present application.
- the implementation process constitutes no limitation.
- the first method is based on manual analysis. Specifically, this method mainly sorts out the columns (or called fields) and data on the interactive forms of each application system when processing various businesses manually, and finds the columns and data of tables that match the columns and data in the database. data. Then, the information is summarized and sorted, and finally the tables and corresponding columns of the database that the application system may call are analyzed.
- the application system is a financial system, and the user needs to query the sales of each quarter of the year. After the user queries, the output data of the financial system are "A", "B", "C” and "D".
- the user can reversely look up "A”, “B”, “C” and “D” in the database, or determine how many A data with characteristics, such as “C” and “D”, and then look up “C” and “D” in the database, and finally analyze the tables and corresponding columns of the database that the financial system may call.
- This method mainly relies on manual experience, so the efficiency and accuracy are relatively low, especially in the case of a database including a large number of tables.
- the calculation logic of the application system after form submission may involve aggregation query and processing of many tables or intermediate table structures, these queries and processing cannot be visually seen from the user interface (UI), so manual
- UI user interface
- the second method is an analysis method based on the organization and structure (Schema) of tables in the database. Specifically, the method obtains the table structure and relationship of all databases in the current application system by calling the relevant interface of the corresponding database of the application system, and finally reversely generates the data model.
- this method cannot dynamically perceive which tables in a certain business database have been accessed, it cannot help users effectively sort out the data models used by the current application system. For example, there are 1000 tables in the database. When a user accesses the data of a certain business, the application system may only use 100 of them. However, since this method cannot know which 100 of the 1000 tables are used, it can only Perform reverse data model generation for all 1000 tables, which takes a long time and is inefficient. In addition, since there may be data generated by non-human-computer interaction or data irrelevant to the business currently accessed by the user in the database, the generated data model may be separated from the business and has nothing to do with the business currently accessed by the user.
- the relationship in the data model generated by this method is highly dependent on the reference foreign key of the table in the database. If there is no such information in the table, the relationship of the data model cannot be generated. A large number of actual production environments have proved that the larger the enterprise system, the less such strong reference foreign key relationships are included. Therefore, the feasibility of this method in the actual production environment is not high.
- the embodiment of the present application proposes a data model generation method, which can generate a data model closely related to the target business with high accuracy and efficiency, so that enterprises can conduct independent research and development based on the generated data model.
- FIG. 1 is a schematic diagram of a system architecture according to an embodiment of the present application.
- the system architecture shown in FIG. 1 includes a client 110 , a database 120 and a third-party device 130 .
- the client 110 may be an interface for providing data query service management.
- the user terminal 110 may also be called a client or other names.
- the database 120 can be, for example, mysql, oracle, sqlserver, sqlite, etc. Information transmission can be carried out between the client terminal 110 and the database 120. For example, when a user needs to inquire about data, such as inquiring about the sales volume of each quarter in a year, the query information can be input at the client terminal 110, and the client terminal 110 receives the query information. After querying the information, convert the query information into a database language, such as structured query language (structured query language, SQL), and send the database language to the database 120 . Afterwards, the database 120 queries the sales of each quarter of the year based on the received database language, and sends the query results to the client 110 . Afterwards, the user terminal 110 can output the query results to the user, so that the user can obtain the sales of each quarter of the year.
- a database language such as structured query language (structured query language, SQL)
- the third-party device 130 may communicate with the client 110 and the database 120 to obtain information transmitted between the client 110 and the database 120 , and perform some operations based on the information, such as generating a data model of the database 120 .
- the third party 130 may include a communication interface to implement a communication connection with other devices (such as the client 110).
- the communication connection may be wired or wireless.
- the third-party device 130 can obtain the information during the information transmission; or, if the client 110 sends information to the database 120, the third-party device 130 can obtain the information from the database 120 after the information is sent to the database 120 .
- the third party device 130 may be a server.
- the server is a device that provides computing services.
- the composition of the server includes a processor, hard disk, memory, system bus, etc.
- the server is similar to a general-purpose computer architecture, but due to the need to provide high Reliability, security, scalability, manageability and other aspects have high requirements.
- FIG. 1 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship among devices, devices, modules, etc. shown in the figure does not constitute any limitation.
- FIG. 2 shows a schematic flowchart of a method 200 for generating a data model according to an embodiment of the present application.
- the method 200 may be executed by a third-party device other than the client and the database, such as the third-party device 130 shown in FIG. 1 .
- the method 200 may include at least part of the following contents.
- Step 210 Obtain the data access statement sent by the client to the database, the data access statement is used to access the data of the target service in the database.
- Step 220 According to the data access statement, obtain the identification of each target table in at least one target table in the database called by the target service and the identification of the target column in each target table.
- Step 230 Determine the data type of the target column according to the identifier of the target table and the schema of the database.
- Step 240 Determine the data model of the database according to the identifier of the target table, the identifier and data type of the target column.
- the data access statement related to the user's operation will be sent from the user end to the database. Therefore, the data access statement obtained in the embodiment of the present application is closely related to the target business accessed by the user, and the data model generated based on the data access statement is also closely related to the target business accessed by the user, which can effectively avoid the generation of a large number of invalid data models. question. Further, the above technical solution does not rely on manual experience, effectively improving the efficiency and accuracy of data model generation.
- the third-party device may include a preprocessor, an analyzer, and a model generator.
- step 210 may be performed by a preprocessor
- step 220 may be performed by an analyzer
- steps 230 and 240 may be performed by a model generator.
- the third-party device may also include other devices, such as a data type processor.
- step 210 may be performed by a preprocessor
- step 220 may be performed by an analyzer
- step 230 may be performed by a data type processor
- step 240 may be performed by a model generator.
- the method in the embodiment of the present application will be described below by taking step 210 to be executed by the preprocessor, step 220 to be executed by the analyzer, and steps 230 and 240 to be executed by the model generator as examples.
- the preprocessor can obtain data access statements through plugins provided by the database, such as command-line tools.
- the preprocessor may enable a certain option, and then may monitor the data access statement sent by the client to the database, so as to obtain the data access statement.
- the preprocessor may obtain the data access statement from the database, or may also obtain the data access statement during the process of transmitting the data access statement from the client to the database.
- the data access statement may include but not limited to SQL statement.
- the embodiment of the present application uses an SQL statement as an example for description.
- the SQL statement may include a data definition language (data definition language, DDL) and a data manipulation language (data manipulation language, DML), and the SQL statement in the embodiment of the present application is a DML statement.
- DML statements may include insert (insert) statements, delete (delete) statements, modify (update) statements, and query (select) statements.
- the SQL statement in the embodiment of the present application is a select statement or an insert statement.
- the database can generate context information based on the SQL statement, such as a generated timestamp, session ID or process ID, etc. That is to say, the database can generate multiple pieces of information based on the target service, and the multiple pieces of information include other information besides multiple SQL statements. Moreover, even SQL statements may include delete statements and update statements.
- the user end may also transmit other information to the database.
- step 210 may specifically include: the preprocessor filters the multiple information generated based on the target business, filters out information other than the SQL statement in the multiple information, and filters out the delete statement and the update statement in the SQL statement , to get the select statement or insert statement.
- the technical solution filters the plurality of information to filter out information other than data access statements in the plurality of information, so that the remaining information is data access statements closely related to the target business, thereby further avoiding the generation of Lots of problems with invalid data models.
- the preprocessor may receive multiple lines of information at the same time, therefore, optionally, as shown in Figure 3 and Figure 4, the preprocessor may also analyze the received multiple lines of information line by line, and then perform Filter to get the SQL statement.
- the identifier of the target table may be a table name of the target table, an ID of the target table, or a serial number of the target table in all tables in the database.
- the identifier of the target column may be a column name of the target column, an ID of the target column, or a number of the target column in the target table.
- the identification of the target table is the table name
- the identification of the target column is the column name.
- the analyzer obtains the table name of the target table and the column name of the target column in different ways.
- the analyzer may extract the first character string between the from (from) keyword and the condition keyword in the select statement, and the first character string is the table name of the target table.
- the select statement is select col1, col2, col3 from table_1where..., the character string between the from keyword and the condition keyword in the select statement is table_1, and the extracted table name is table_1.
- the select statement is select col1, col2, col3 from table_1 left join table_2 on..., the strings between the from keyword and the condition keyword in the select statement are table_1 and table_2, and the extracted table names are table_1 and table_2.
- the multiple first character strings can be separated by commas to obtain a set of table names, such as [table_1, table_2] above.
- the analyzer may extract a second character string between the select keyword and the from keyword in the select statement, where the second character string is the column name of the target column. If there are multiple column names, multiple column names can also be separated by commas.
- the select statement is select col1, col2, col3 from table_1 where...
- the string between the select keyword and the from keyword in the select statement is col1, col2, col3, and the column name of the target column is [col1, col2, col3].
- the analyzer can extract the fourth character string between the insert into keyword and the values keyword in the insert statement, and the fourth character string is the table name of the target table.
- the analyzer may extract the fifth character string in the parentheses behind the values keyword in the insert statement, where the fifth character string is the column name of the target column.
- method 200 It may also include: the analyzer obtains the relationship of multiple target tables in the target business according to the connection query statement. In other words, the analyzer can obtain which columns are associated among multiple target tables in the target business according to the connection query statement.
- the analyzer can obtain the relationship of multiple target tables in the target business from the third character string after the condition keyword in the join query statement.
- table_1 and table_2 After determining the relationship between table_1 and table_2, you can concatenate table1, col1, table2, and col2 together to form a quadruple [table1, col1, table2, col2].
- This quadruple can indicate that table_1 and table_2 are associated through the column named col1 in table_1 and the column named col2 in table_2.
- the third character string after the condition keyword can be extracted respectively to obtain a multi-dimensional quaternion array. For example:
- the analyzer in addition to determining the data model according to the table name of the target table, the column name and data type of the target column, the analyzer can also determine the data model according to the relationship between multiple tables in the target business.
- the structural information in the data access statement is used to analyze the potential relationship between tables, and a data model is generated according to the relationship. Since the above technical solution does not depend on the reference foreign key in the schema in the database, it avoids the disadvantages of the generated data model being inaccurate or even unable to generate the data model relationship due to the absence of the reference foreign key in the schema in the database, which further improves the generated data. model accuracy.
- the analyzer obtains the table name of the target table and the column name of the target column in different ways. Therefore, in one implementation, there can be two analyzers, one of which (for convenience of description, called the first analyzer) can obtain the table name of the target table, the column name of the target column and multiple For the relationship of the target table in the target business, another analyzer (called the second analyzer) can obtain the table name of the target table and the column name of the target column in the insert statement.
- the first analyzer for convenience of description, called the first analyzer
- the second analyzer can obtain the table name of the target table and the column name of the target column in the insert statement.
- the analyzer in Figure 3 is the second analyzer, and the second analyzer can obtain table names and column names; the analyzer in Figure 4 is the first analyzer, and the first analysis The browser can get the table name, column name and the relationship between the table and the table.
- the preprocessor may determine the type of the SQL statement, and then send the SQL statement to the corresponding analyzer. That is, the select statement is sent to the first analyzer in Figure 4, and the insert statement is sent to the second analyzer in Figure 3.
- the analyzer in FIG. 4 .
- the analyzer can perform three steps: obtaining the table name of the target table in the SQL statement, obtaining the column name of the target column, and obtaining the relationship of multiple target tables in the target business. If the SQL statement is a connection query statement, the analyzer can execute the three steps in sequence; if the SQL statement is another statement (such as an insert statement), the analyzer does not need to execute the relationship between multiple target tables in the target business. In this step, only the first two steps are performed.
- the method 200 may also include: aggregating the table name of the target table and the column name of the target column, or aggregating the table name of the target table, the column name of the target column Column names and the relationship between multiple target tables in the target business are aggregated.
- the aggregated table names and column names may be referred to as a structured result set, or the aggregated table names, column names, and relationships may be referred to as a structured result set.
- the structured result set can be understood to describe an object in a non-discrete manner. For example, when describing what items are in the supermarket, it can be described as apples, bananas, etc. for fruits, laundry detergent, towels, etc. for daily necessities, and potatoes, tomatoes, etc. for vegetables, instead of bananas, laundry detergent, potatoes, etc. in the supermarket.
- the table names are table_X and table_Y respectively, where the column names of the target columns in table_X are col1, col2 and colN respectively, and the column names of the target columns in table_Y are col1, col2 and colN respectively , and table_X and table_Y are associated through the column named col1 in table_X and the column named col2 in table_Y.
- JSON JS object notation
- the above technical solution before generating the data model, aggregates the identification of the target table and the identification of the target column. Compared with the identification of the target table and the identification of the target column in a discrete state, it is convenient for subsequent operations and is conducive to improving the efficiency of data model generation. efficiency.
- Model Builder After the analyzer determines the column name of the target column, Model Builder also needs to determine the data type of the target column. For example, whether the data type of the target column is an integer type or a string type. Specifically, the model generator can extract the data type of the target column in the target table from the schema of the database according to the table name of the target table, so that a list of triples can be obtained, for example, [[table_1,col1,datatype] ,[table_1,col2,datatype],[table_N,colN,datatype]]. Among them, datatype represents the data type.
- the model generator can base on the table name of the target table, the column name and data type of the target column, or based on the table name of the target table, the column name of the target column, multiple target tables in the target business
- the relationships and data types on the database determine the data model of the database.
- the table name of the target table can be used as the entity name of the data model
- the column name of the target column can be used as the attribute name of the corresponding entity
- the data type of the target column can be used as the data type of the corresponding entity attribute.
- the target table of the target business call includes four, and the table names are Table_X, Table_Y, Table_Z, and Table_N, where the column name of the target column in Table_X is Col_X, and the data type of the target column is Datatype_X; the column name of the target column in Table_Y Col_Y, the data type of the target column is Datatype_Y; the column name of the target column in Table_Z is Col_Z, the data type of the target column is Datatype_Z; the column name of the target column in Table_N is Col_N, and the data type of the target column is Datatype_N.
- the generated data model can be shown in Table 1.
- the table names of the multiple target tables that are related to each other can be used as the entity names of the multiple related entities, and the column names of the multiple target columns that are related to each other As an associated property of multiple entities that are related to each other.
- Table 1 Take Table 1 as an example for illustration. Assuming that Table_X and Table_Y are related to each other through the column named Col_X in Table_X and the column named Col_Y in Table_Y, and Table_Z and TableN are related to each other through the column named Col_Z in Table_Z and the column named Col_Z in Table_N, then The obtained relationships among the multiple entities can be shown in Table 2.
- from_tab and to_tab are the entity names of the two entities that are related to each other.
- from_col and to_col are the associated attributes of the two entities associated with each other.
- the analyzer can also perform attribute expansion on the entity with the same name.
- the method 200 may further include: persisting the data model, so as to store the data model in an underlying database.
- Fig. 5 shows a schematic block diagram of an apparatus 500 for generating a data model according to an embodiment of the present application.
- the apparatus 500 for generating a data model may execute the method 200 for generating a data model in the embodiment of the present application, and the apparatus 500 for generating a data model may be a third-party device in the foregoing method.
- the device 500 for generating the data model may include:
- the preprocessor 510 is configured to obtain a data access statement sent by the client to the database, and the data access statement is used to access data of a target service in the database.
- the analyzer 520 is configured to obtain, according to the data access statement, an identifier of each target table in at least one target table in the database called by the target service and an identifier of a target column in the target table.
- a model generator 530 configured to determine the data type of the target column according to the identifier of the target table and the organization and structure of the tables in the database.
- the model generator 530 is further configured to determine the data model of the database according to the identifier of the target table, the identifier of the target column, and the data type.
- the preprocessor 510 is specifically configured to: filter a plurality of information generated based on the target service to obtain the data access statement, wherein the plurality of The information includes the data access statements.
- the analyzer 520 is specifically configured to: when the data access statement is a query statement, extract the first keyword between the secondary keyword and the conditional keyword in the query statement.
- a character string, the first character string is the identification of the target table; extract the second character string between the selection keyword and the secondary keyword in the query access statement, the second character string is The ID of the target column.
- the analyzer 520 is specifically configured to: according to the connection query statement , to obtain the relationship of the multiple target tables on the target business; according to the identifier of the target table, the identifier of the target column, the relationship of the multiple target tables on the target business and the data Type, which identifies the data model.
- the analyzer 520 is specifically configured to: obtain the multiple target tables from the third character string after the condition keyword in the connection query statement.
- the target business relationship is specifically configured to: obtain the multiple target tables from the third character string after the condition keyword in the connection query statement.
- the analyzer 520 is specifically configured to: when the data access statement is an insert statement, extract the first key between the insert keyword and the value keyword in the insert statement.
- the fourth character string is the identifier of the target table; extract the fifth character string in brackets after the value keyword in the insert statement, the fifth character string is the target column logo.
- the analyzer 520 is further configured to: aggregate the identifier of the target table and the identifier of the target column; the model generator 530 is specifically configured to: based on aggregation The identification of the target table and the identification of the target column, and based on the data type, determine the data model.
- preprocessor 510 the analyzer 520, and the model generator 530 can respectively implement the corresponding operations of the preprocessor, analyzer, and model generator in the method 200, and details are not repeated here for brevity.
- FIG. 6 shows a schematic block diagram of an apparatus 600 for generating a data model according to another embodiment of the present application.
- the apparatus 600 for generating a data model may execute the method 200 for generating a data model in the embodiment of the present application, and the apparatus 600 for generating a data model may be a third-party device in the foregoing method.
- the device 600 for generating the data model may include:
- the obtaining unit 610 is configured to obtain a data access statement sent by the client to the database, where the data access statement is used to access data of a target service in the database.
- the obtaining unit 610 is further configured to obtain, according to the data access statement, an identifier of each target table in at least one target table in the database called by the target service and an identifier of a target column in the target table.
- the determining unit 620 is configured to determine the data type of the target column according to the identifier of the target table and the organization and structure of the tables in the database.
- the determining unit 620 is further configured to determine the data model of the database according to the identifier of the target table, the identifier of the target column, and the data type.
- the obtaining unit 610 is specifically configured to: filter a plurality of pieces of information generated based on the target service to obtain the data access statement, wherein the pieces of information Include the data access statement.
- the acquiring unit 610 is specifically configured to: when the data access statement is a query statement, extract the first keyword between the secondary keyword and the conditional keyword in the query statement.
- a character string, the first character string is the identifier of the target table; extract the second character string between the selection keyword and the secondary keyword in the query statement, the second character string is the The ID of the target column described above.
- the obtaining unit 610 is specifically configured to: according to the connection query statement , to obtain the relationship of the multiple target tables on the target business; according to the identification of the target table, the identification of the target column, the relationship of the multiple target tables on the target business and the data Type, which identifies the data model.
- the acquiring unit 610 is specifically configured to: acquire the multiple target tables from the third character string after the condition keyword in the connection query statement.
- the target business relationship is specifically configured to: acquire the multiple target tables from the third character string after the condition keyword in the connection query statement.
- the acquiring unit 610 is specifically configured to: when the data access statement is an insert statement, extract the first key between the insert keyword and the value keyword in the insert statement.
- the fourth character string is the identification of the target table; extract the fifth character string in the query brackets of the value keyword in the insert statement, the fifth character string is the target column logo.
- the data model generation apparatus 600 further includes an aggregation unit configured to aggregate the identifier of the target table and the identifier of the target column; the determining unit 620 specifically It is configured to: determine the data model based on the aggregated identifier of the target table and the identifier of the target column, and based on the data type.
- FIG. 7 is a schematic diagram of a hardware structure of an apparatus 700 for generating a data model according to an embodiment of the present application.
- the apparatus 700 for generating a data model shown in FIG. 7 may be a third-party device, and the apparatus 700 for generating a data model includes a memory 701 , a processor 702 , a communication interface 703 and a bus 704 .
- the memory 701 , the processor 702 , and the communication interface 703 are connected to each other through a bus 704 .
- the memory 701 may be a read-only memory (read-only memory, ROM), a static storage device and a random access memory (random access memory, RAM).
- the memory 701 may store a program. When the program stored in the memory 701 is executed by the processor 702, the processor 702 and the communication interface 703 are used to execute each step of the method for generating a data model in the embodiment of the present application.
- the processor 702 can adopt a general-purpose CPU, a microprocessor, an application specific integrated circuit (application specific integrated circuit, ASIC), a graphics processing unit (graphics processing unit, GPU) or one or more integrated circuits for executing related programs, In order to realize the functional functions required to be executed by the units in the device of the embodiment of the present application, or execute the method for generating the data model of the embodiment of the present application.
- ASIC application specific integrated circuit
- GPU graphics processing unit
- the processor 702 may also be an integrated circuit chip, which has a signal processing capability. During implementation, each step of the method for generating a data model in the embodiment of the present application may be completed by an integrated logic circuit of hardware in the processor 702 or instructions in the form of software.
- processor 702 can also be general-purpose processor, digital signal processor (digital signal processing, DSP), ASIC, off-the-shelf programmable gate array (field programmable gate array, FPGA) or other programmable logic device, discrete gate or transistor logic devices, discrete hardware components.
- DSP digital signal processor
- ASIC off-the-shelf programmable gate array
- FPGA field programmable gate array
- Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed.
- a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
- the steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
- the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
- the storage medium is located in the memory 701, and the processor 702 reads the information in the memory 701, and combines its hardware to complete the functions required by the units included in the device of the embodiment of the present application, or execute the functions generated by the data model of the embodiment of the present application. method.
- the communication interface 703 uses a transceiver device such as but not limited to a transceiver to implement communication between the data model generation apparatus 700 and other devices or communication networks.
- a transceiver device such as but not limited to a transceiver to implement communication between the data model generation apparatus 700 and other devices or communication networks.
- the bus 704 may include a path for transferring information between various components of the data model generation apparatus 700 (eg, memory 701 , processor 702 , communication interface 703 ).
- the device 700 for generating a data model only shows a memory, a processor, and a communication interface
- the device 700 for generating a data model may also include other necessary devices.
- the apparatus 700 for generating a data model may also include hardware devices for implementing other additional functions.
- the apparatus 700 for generating a data model may only include components necessary to implement the embodiment of the present application, and does not necessarily include all the components shown in FIG. 7 .
- the embodiment of the present application also provides a computer-readable storage medium, which stores program code for execution by a device, where the program code includes instructions for executing the steps in the above method for generating a data model.
- the embodiment of the present application also provides a computer program product, the computer program product includes a computer program stored on a computer-readable storage medium, the computer program includes program instructions, and when the program instructions are executed by the computer, the The computer executes the above-mentioned method for generating a data model.
- the above-mentioned computer-readable storage medium may be a transitory computer-readable storage medium, or a non-transitory computer-readable storage medium.
- the disclosed devices and methods may be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function function division.
- multiple units or components can be combined Or it can be integrated into another system, or some features can be ignored, or not implemented.
- the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
- the aspects, implementations, implementations or features of the described embodiments can be used alone or in any combination. Aspects of the described embodiments can be implemented by software, hardware or a combination of hardware and software.
- the described embodiments may also be embodied by a computer-readable medium storing computer-readable code comprising instructions executable by at least one computing device.
- the computer readable medium can be associated with any data storage device that can store data that can be read by a computer system.
- Exemplary computer readable media may include read-only memory, random access memory, compact disc read-only memory (CD-ROM), hard disk drive (HDD), digital Video disc (digital video disc, DVD), magnetic tape, and optical data storage device, etc.
- the computer readable medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed manner.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
| From_Entity | From_Attribute_Name | To_Entity | To_Attribute_Name |
| Table_X | Col_X | Table_Y | Col_Y |
| Table_N-1 | Col_N-1 | Table_N | Col_N |
Claims (11)
- 一种数据模型生成的方法,其特征在于,所述方法包括:获取(210)用户端向数据库发送的数据访问语句,所述数据访问语句用于访问所述数据库中目标业务的数据;根据所述数据访问语句,获取(220)所述目标业务调用的所述数据库中的至少一个目标表中每一个目标表的标识和所述目标表中目标列的标识;根据所述目标表的标识和所述数据库中表的组织和结构,确定(230)所述目标列的数据类型;根据所述目标表的标识、所述目标列的标识和所述数据类型,确定(240)所述数据库的数据模型。
- 根据权利要求1所述的方法,其特征在于,所述获取(210)用户端向数据库发送的数据访问语句,包括:对基于所述目标业务生成的多个信息进行过滤,以得到所述数据访问语句,其中,所述多个信息包括所述数据访问语句。
- 根据权利要求1或2所述的方法,其特征在于,所述根据所述数据访问语句,获取(220)所述目标业务调用的所述数据库中的至少一个目标表中每一个目标表的标识和所述目标表中目标列的标识,包括:当所述数据访问语句为查询语句时,提取所述查询语句中的从关键字与条件关键字之间的第一字符串,所述第一字符串为所述目标表的标识;提取所述查询语句中的选择关键字与所述从关键字之间的第二字符串,所述第二字符串为所述目标列的标识。
- 根据权利要求3所述的方法,其特征在于,当所述查询语句为连接查询语句且所述至少一个目标表包括多个目标表时,所述方法还包括:根据所述连接查询语句,获取所述多个目标表在所述目标业务上的关系;所述根据所述目标表的标识、所述目标列的标识和所述数据类型,确定(240)所述数据库的数据模型,包括:根据所述目标表的标识、所述目标列的标识、所述多个目标表在所述目标业务上的关系以及所述数据类型,确定所述数据模型。
- 根据权利要求4所述的方法,其特征在于,所述根据所述连接查询语句,获取所述多个目标表在所述目标业务上的关系,包括:从所述连接查询语句中的所述条件关键字之后的第三字符串中,获取所述多个目标表在所述目标业务上的关系。
- 根据权利要求1或2所述的方法,其特征在于,所述根据所述数据访问语句,获取(220)所述目标业务调用的所述数据库中的至少一个目标表中每一个目标表的标识和所述目标表中目标列的标识,包括:当所述数据访问语句为插入语句时,提取所述插入语句中的插入关键字与值关键字之间的第四字符串,所述第四字符串为所述目标表的标识;提取所述插入语句中所述值关键字之后的括号内的第五字符串,所述第五字符串为 所述目标列的标识。
- 根据权利要求1至6中任一项所述的方法,其特征在于,所述方法还包括:对所述目标表的标识和所述目标列的标识进行聚合;所述根据所述目标表的标识、所述目标列的标识和所述数据类型,确定(240)所述数据库的数据模型,包括:基于聚合后的所述目标表的标识和所述目标列的标识,以及基于所述数据类型,确定所述数据模型。
- 一种数据模型生成的装置(700),其特征在于,包括:存储器(701),用于存储程序;处理器(702),用于执行所述存储器存储的程序,当所述存储器存储的程序被执行时,所述处理器用于获取用户端向数据库发送的数据访问语句,所述数据访问语句用于访问所述数据库中目标业务的数据;所述处理器(702)还用于根据所述数据访问语句,获取所述目标业务调用的所述数据库中的至少一个目标表中每一个目标表的标识和所述目标表中目标列的标识;所述处理器(702)还用于根据所述目标表的标识和所述数据库中表的组织和结构,确定所述目标列的数据类型;所述处理器(702)还用于根据所述目标表的标识、所述目标列的标识和所述数据类型,确定所述数据库的数据模型。
- 一种计算机可读存储介质,其特征在于,所述计算机可读介质存储用于设备执行的程序代码,所述程序代码包括用于执行根据权利要求1至7中任一项所述的数据模型生成的方法中的步骤的指令。
- 一种数据模型生成的装置(500),其特征在于,包括:预处理器(510),用于获取用户端向数据库发送的数据访问语句,所述数据访问语句用于访问所述数据库中目标业务的数据;分析器(520),用于根据所述数据访问语句,获取所述目标业务调用的所述数据库中的至少一个目标表中每一个目标表的标识和所述目标表中目标列的标识;模型生成器(530),用于根据所述目标表的标识和所述数据库中表的组织和结构,确定所述目标列的数据类型;所述模型生成器(530)还用于,根据所述目标表的标识、所述目标列的标识和所述数据类型,确定所述数据库的数据模型。
- 一种数据模型生成的装置(600),其特征在于,包括:获取单元(610),用于获取用户端向数据库发送的数据访问语句,所述数据访问语句用于访问所述数据库中目标业务的数据;所述获取单元(610)还用于,根据所述数据访问语句,获取所述目标业务调用的所述数据库中的至少一个目标表中每一个目标表的标识和所述目标表中目标列的标识;确定单元(620),用于根据所述目标表的标识和所述数据库中表的组织和结构,确定所述目标列的数据类型;所述确定单元(620)还用于,根据所述目标表的标识、所述目标列的标识和所述数据类型,确定所述数据库的数据模型。
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202180104732.3A CN118556232A (zh) | 2021-11-30 | 2021-11-30 | 数据模型生成的方法和装置 |
| PCT/CN2021/134650 WO2023097521A1 (zh) | 2021-11-30 | 2021-11-30 | 数据模型生成的方法和装置 |
| EP21965958.8A EP4432117A4 (en) | 2021-11-30 | 2021-11-30 | METHOD AND APPARATUS FOR GENERATING DATA MODEL |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2021/134650 WO2023097521A1 (zh) | 2021-11-30 | 2021-11-30 | 数据模型生成的方法和装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023097521A1 true WO2023097521A1 (zh) | 2023-06-08 |
Family
ID=86611424
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/134650 Ceased WO2023097521A1 (zh) | 2021-11-30 | 2021-11-30 | 数据模型生成的方法和装置 |
Country Status (3)
| Country | Link |
|---|---|
| EP (1) | EP4432117A4 (zh) |
| CN (1) | CN118556232A (zh) |
| WO (1) | WO2023097521A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117113960A (zh) * | 2023-09-05 | 2023-11-24 | 北京数聚智连科技股份有限公司 | 业务数据表单的生成方法、装置、电子设备及存储介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110019377A (zh) * | 2017-12-14 | 2019-07-16 | 中国移动通信集团山西有限公司 | 动态脱敏方法、装置、设备及介质 |
| CN110795756A (zh) * | 2019-09-25 | 2020-02-14 | 江苏满运软件科技有限公司 | 一种数据脱敏方法、装置、计算机设备及计算机可读存储介质 |
| CN111324647A (zh) * | 2020-01-21 | 2020-06-23 | 北京东方金信科技有限公司 | 一种生成etl代码的方法及装置 |
| CN111712809A (zh) * | 2018-04-16 | 2020-09-25 | 甲骨文国际公司 | 通过示例来学习etl规则 |
| WO2021168331A1 (en) * | 2020-02-20 | 2021-08-26 | Oracle International Corporation | System and method for automatic generation of bi models using data introspection and curation |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6163776A (en) * | 1998-03-23 | 2000-12-19 | Software Tree, Inc. | System and method for exchanging data and commands between an object oriented system and relational system |
| US20140244680A1 (en) * | 2013-02-28 | 2014-08-28 | Lakshmy Chandran | Sql query parsing and translation |
-
2021
- 2021-11-30 EP EP21965958.8A patent/EP4432117A4/en active Pending
- 2021-11-30 CN CN202180104732.3A patent/CN118556232A/zh active Pending
- 2021-11-30 WO PCT/CN2021/134650 patent/WO2023097521A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110019377A (zh) * | 2017-12-14 | 2019-07-16 | 中国移动通信集团山西有限公司 | 动态脱敏方法、装置、设备及介质 |
| CN111712809A (zh) * | 2018-04-16 | 2020-09-25 | 甲骨文国际公司 | 通过示例来学习etl规则 |
| CN110795756A (zh) * | 2019-09-25 | 2020-02-14 | 江苏满运软件科技有限公司 | 一种数据脱敏方法、装置、计算机设备及计算机可读存储介质 |
| CN111324647A (zh) * | 2020-01-21 | 2020-06-23 | 北京东方金信科技有限公司 | 一种生成etl代码的方法及装置 |
| WO2021168331A1 (en) * | 2020-02-20 | 2021-08-26 | Oracle International Corporation | System and method for automatic generation of bi models using data introspection and curation |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4432117A4 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117113960A (zh) * | 2023-09-05 | 2023-11-24 | 北京数聚智连科技股份有限公司 | 业务数据表单的生成方法、装置、电子设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| EP4432117A1 (en) | 2024-09-18 |
| EP4432117A4 (en) | 2025-09-03 |
| CN118556232A (zh) | 2024-08-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11379475B2 (en) | Analyzing tags associated with high-latency and error spans for instrumented software | |
| CN113051268B (zh) | 数据查询方法、数据查询装置、电子设备及存储介质 | |
| CN110096494B (zh) | 使用源跟踪剖析数据 | |
| US8924373B2 (en) | Query plans with parameter markers in place of object identifiers | |
| US9495437B1 (en) | System and method for accessing dimensional databases | |
| CN106687955B (zh) | 简化将数据从数据源转移到数据目标的导入过程的调用 | |
| CN108052635A (zh) | 一种异构数据源统一联合查询方法 | |
| CN113918605A (zh) | 数据查询方法、装置、设备以及计算机存储介质 | |
| CN114417408A (zh) | 数据处理方法、装置、设备以及存储介质 | |
| CN114741392A (zh) | 数据查询方法、装置、电子设备及存储介质 | |
| US10496645B1 (en) | System and method for analysis of a database proxy | |
| CN111625561A (zh) | 一种数据查询方法及装置 | |
| US9489423B1 (en) | Query data acquisition and analysis | |
| CN114116764A (zh) | 一种基于语法树的指标查询方法、装置、介质及电子设备 | |
| CN112667733A (zh) | 数据仓库数据导入方法与系统 | |
| WO2020088262A1 (zh) | 数据分析方法、设备及存储介质 | |
| WO2021217119A1 (en) | Analyzing tags associated with high-latency and error spans for instrumented software | |
| CN115408417A (zh) | 一种数据查询方法、系统、电子设备及存储介质 | |
| US20220197950A1 (en) | Eliminating many-to-many joins between database tables | |
| US11132363B2 (en) | Distributed computing framework and distributed computing method | |
| CN118556232A (zh) | 数据模型生成的方法和装置 | |
| US10789249B2 (en) | Optimal offset pushdown for multipart sorting | |
| CN114780554B (zh) | 处理数据库查询语句的方法及装置 | |
| CN114490724B (zh) | 处理数据库查询语句的方法和装置 | |
| CN117785984A (zh) | 数据抽取方法、装置、电子设备以及存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21965958 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 202180104732.3 Country of ref document: CN |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2021965958 Country of ref document: EP |
|
| ENP | Entry into the national phase |
Ref document number: 2021965958 Country of ref document: EP Effective date: 20240612 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |


