Data mapping relation determination method, electronic equipment, storage medium and program
By acquiring a collection of multiple data sources from the target system, performing file scanning and parsing, and determining the mapping relationships between multiple related objects of the data sources, the problem of existing tools being unable to establish mapping relationships is solved, thereby improving the efficiency and accuracy of data management in a multi-data source architecture.
Patent Information
- Application Number
- CN202511089510.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-05
- Publication Date
- 2025-11-07
AI Technical Summary
Existing database analysis tools are unable to effectively establish multi-related object mapping relationships in multi-data source architectures, making it difficult for developers to understand the complete flow path of data operations, affecting problem localization and performance optimization.
By acquiring a collection of multiple target data sources for the target system, file scanning and filtering are performed, data source attribute information is parsed, and the mapping relationship between multiple related objects is determined, including hierarchical annotations of data source operation methods and data table parsing, thus establishing the mapping relationship between the target data source and the operation methods.
It enables the effective establishment of multi-related object mapping relationships in a multi-data source architecture, reduces manual operation costs, improves the efficiency and accuracy of data management, and supports domestic innovation migration and localization adaptation.
Smart Images

Figure CN120910076A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the field of computer application and financial technology, and particularly to a data mapping relationship determination method, electronic device, storage medium and program. BACKGROUND
[0002] In the current application system development process, multi-data source architecture has become the mainstream choice to cope with high concurrency, large data volume and complex business scenarios. Under this architecture, the Mapper layer plays a crucial role, which is responsible for converting the request of the business logic layer into specific database operations and ensuring that these operations can be correctly routed to the corresponding data source.
[0003] However, the main function of the existing database analysis tool is focused on monitoring the SQL (Structured Query Language) statements of the application system runtime, and cannot establish the multi-association object mapping relationship of the target data source. This makes it difficult for developers to clearly understand the complete flow path of data operation in the multi-data source architecture, which in turn affects the comprehensive analysis, problem positioning and performance optimization adjustment of the database operation. SUMMARY
[0004] Embodiments of the present application provide a data mapping relationship determination method, electronic device, storage medium and program, which can effectively establish the multi-association object mapping relationship of the data source in the multi-data source architecture.
[0005] According to an aspect of the present application, a data mapping relationship determination method is provided, comprising:
[0006] obtaining a target data source set composed of multiple target data sources adopted by a target system;
[0007] performing file scanning according to a target scanning path of the target data source set, and screening target scanning files according to the file scanning result;
[0008] parsing the target scanning files according to the data source attribute information of the target data source set, and determining the multi-association object mapping relationship of each target data source according to the parsing result of the target scanning files.
[0009] According to another aspect of the present application, a data mapping relationship determination device is provided, comprising:
[0010] a target data source set obtaining module configured to obtain a target data source set composed of multiple target data sources adopted by a target system;
[0011] The target scanning file screening module is configured to perform file scanning according to a target scanning path of the target data source set, and screen a target scanning file according to a file scanning result.
[0012] The multi-correlation object mapping relationship determining module is configured to analyze the target scanning file according to data source attribute information of the target data source set, and determine a multi-correlation object mapping relationship of each target data source according to an analysis result of the target scanning file.
[0013] According to another aspect of the present application, an electronic device is provided, which comprises:
[0014] at least one processor; and
[0015] a memory connected with the at least one processor in communication; wherein,
[0016] The memory stores a computer program which can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data mapping relationship determining method according to any one of the embodiments of the present application.
[0017] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the data mapping relationship determining method according to any one of the embodiments of the present application when executed by the processor.
[0018] According to another aspect of the present application, a computer program product is also provided, which comprises a computer program for implementing the data mapping relationship determining method according to any one of the embodiments of the present application when executed by a processor.
[0019] The embodiments of the present application acquire a target data source set composed of multiple target data sources adopted by a target system, perform file scanning according to a target scanning path of the target data source set, and screen a target scanning file according to a file scanning result. After the target data source set and the target scanning file are determined, the target scanning file is analyzed according to data source attribute information of the target data source set, and a multi-correlation object mapping relationship of each target data source is determined according to an analysis result of the target scanning file. The above-mentioned solution solves the defect that the existing database analysis tool cannot establish a multi-correlation object mapping relationship of a data source in a multi-data source architecture, and can effectively establish a multi-correlation object mapping relationship of a data source in a multi-data source architecture.
[0020] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments description will be briefly introduced as follows. Obviously, the drawings in the following description only represent some of the embodiments of the present application, and all other drawings obtained by those skilled in the art without any creative effort based on these drawings should also fall within the protection scope of the present application.
[0022] Figure 1 is a flow chart of a data mapping relationship determination method provided by an embodiment of the present application;
[0023] Figure 2 is a flow chart of a data mapping relationship determination method provided by an embodiment of the present application;
[0024] Figure 3 is a flow chart of a data mapping relationship determination method provided by an embodiment of the present application;
[0025] Figure 4 is a schematic diagram of a data mapping relationship determination device provided by an embodiment of the present application;
[0026] Figure 5 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments only represent some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort should fall within the protection scope of the present application.
[0028] It should be noted that the terms "first", "second" and "target" and the like in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to include all the steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0029] Embodiment one
[0030] Figure 1 is a flowchart of a data mapping relationship determination method provided by an embodiment of the present application. The embodiment can be applicable to the case of establishing a multi-association object mapping relationship of a data source in a multi-data source architecture. The method can be executed by a data mapping relationship determination apparatus. The apparatus can be implemented in software and / or hardware, and can be integrated in an electronic device. The electronic device can be a terminal device or a server device, as long as it can execute the data mapping relationship determination method. The embodiment of the present application does not limit the specific type of the electronic device. Correspondingly, as shown in Figure 1 the method includes the following operations.
[0031] S110, obtaining a target data source set composed of multiple target data sources adopted by a target system.
[0032] The target system can be any application system having a data mapping relationship determination requirement. The multiple target data sources can be multiple data sources configured and used in the target system. Exemplarily, the data sources can include, but are not limited to, databases, etc. The embodiment of the present application does not limit the type of the data sources. The target data source set can be a set composed of multiple target data sources adopted by the target system.
[0033] In the embodiment of the present application, the application system having a data mapping relationship determination requirement can be taken as the target system. The target system adopts a multi-data source architecture. Therefore, the set composed of multiple target data sources adopted by the target system can be taken as the target data source set. Exemplarily, the target data source set can include, but is not limited to, an Oracle database, a MySQL database, a Gauss database, etc. The embodiment of the present application does not limit the specific content included in the target data source set.
[0034] S120, performing file scanning according to a target scanning path of the target data source set, and screening a target scanning file according to a file scanning result.
[0035] The target scanning path can be a path of a file associated with the target data source set in the target system. The target scanning file can be a file including multiple association objects of the target data source.
[0036] Correspondingly, after obtaining the target data source set composed of multiple target data sources adopted by the target system, a path of a file associated with the target data source set in the target system can be taken as a target scanning path. Further, file scanning can be performed according to the target scanning path of the target data source set to obtain a set of all files under the target scanning path. After obtaining the set of all files under the target scanning path, a target scanning file related to multiple associated objects of the target data source can be screened from the set of all files according to the feature identifier.
[0037] In S130, the target scanning file is parsed according to data source attribute information of the target data source set, and a multiple associated object mapping relationship of each target data source is determined according to a parsing result of the target scanning file.
[0038] The data source attribute information of the target data source set can be various information related to each target data source. For example, the data source attribute information of the target data source set can include, but is not limited to, a data source identifier and a data structure of the target data source, and the embodiment of the application does not limit the specific content of the data source attribute information of the target data source set. The multiple associated object mapping relationship can be a corresponding relationship between multiple associated objects in the target data source.
[0039] Correspondingly, after determining the target scanning file, the target scanning file can be parsed according to the data source attribute information of the target data source set to obtain a parsing result of the target scanning file. Further, the multiple associated object mapping relationship of each target data source can be determined according to the parsing result of the target scanning file.
[0040] The embodiment of the application obtains a target data source set composed of multiple target data sources adopted by a target system, performs file scanning according to a target scanning path of the target data source set, and screens a target scanning file according to a file scanning result. After determining the target data source set and the target scanning file, the target scanning file is parsed according to data source attribute information of the target data source set, and a multiple associated object mapping relationship of each target data source is determined according to a parsing result of the target scanning file. The above scheme solves the defect that the existing database analysis tool cannot establish a multiple associated object mapping relationship of a data source in a multiple data source environment, and can effectively establish a multiple associated object mapping relationship of a data source in a multiple data source architecture.
[0041] Embodiment two
[0042] Figure 2is a flow chart of a data mapping relationship determination method provided by Embodiment Two of the present application, which is based on the above-mentioned embodiment and is embodied in the present embodiment. In the present embodiment, a plurality of specific and optional implementation manners of analyzing a target scanning file according to data source attribute information of a target data source set and determining a multi-association object mapping relationship of each target data source according to an analysis result of the target scanning file are given. Correspondingly, as shown in Figure 2 the method of the present embodiment can include:
[0043] S210, acquiring a target data source set composed of a plurality of target data sources adopted by a target system.
[0044] S220, performing file scanning according to a target scanning path of the target data source set, and screening a target scanning file according to a file scanning result.
[0045] In an optional embodiment of the present application, the file scanning according to the target scanning path of the target data source set and the screening of the target scanning file according to the file scanning result can include: performing file scanning according to the target scanning path of the target data source set to obtain a scanning file set under the target scanning path; and screening the scanning file set according to a characteristic identifier of the target scanning file to obtain the target scanning file.
[0046] The scanning file set under the target scanning path can be a set of all files under the target scanning path. The characteristic identifier of the target scanning file can be an identifier of the target scanning file, for example, can include but is not limited to a file name of the target scanning file, etc., and the present embodiment does not limit the specific type of the characteristic identifier of the target scanning file.
[0047] In the present embodiment, when the file scanning according to the target scanning path of the target data source set and the screening of the target scanning file according to the file scanning result are performed, first, the file scanning according to the target scanning path of the target data source set can be performed to obtain all files under the target scanning path and take them as a scanning file set under the target scanning path. Further, the scanning file set can be screened according to the characteristic identifier of the target scanning file, so that the files in the scanning file set that meet the characteristic identifier of the target scanning file can be determined. The above-mentioned scheme screens the target scanning file through the characteristic identifier of the target scanning file, which can quickly locate the target scanning file, thereby improving the analysis efficiency of the target scanning file.
[0048] In a specific example, in order to determine the data mapping relationship under the multi-data source architecture, the Mapper interface and the XML file in the Mapper layer can be parsed. Therefore, the "Mapper.xml" can be taken as the feature identifier of the target scanning file, and the scanning file set is screened according to the feature identifier, so that the file ending with "Mapper.xml" in the scanning file set can be obtained.
[0049] S230, the data source operation method included in the target scanning file is parsed to obtain a target data source operation method set corresponding to the target scanning file.
[0050] The data source operation method can be a function or method for performing various operations on the data source. The target data source operation method set can be a set of data source operation methods of each target data source.
[0051] Correspondingly, the target scanning file includes the data source operation method corresponding to each target data source in the target data source set, for example, can include but is not limited to the Mapper method, and the embodiment of the application does not limit the specific type of the data source operation method. Therefore, after determining the target scanning file, the data source operation method included in the target scanning file can be parsed, so that the target data source operation method set corresponding to the target scanning file can be obtained. It can be understood that the target data source operation method set can include one or more data source operation methods.
[0052] S240, according to the data source attribute information of the target data source set, the target data source operation method set is multi-level parsed, and according to the multi-level parsing result of the target scanning file, the multi-association object mapping relationship of each target data source is determined.
[0053] The multi-level parsing result of the target scanning file can be the result obtained by multi-level parsing the target scanning file.
[0054] Correspondingly, after determining the target data source operation method set, the target data source operation method set can be multi-level parsed according to the data source attribute information of the target data source set, so as to determine the multi-association object mapping relationship of each target data source according to the multi-level parsing result of the target scanning file. In the above scheme, the target data source operation method set is multi-level parsed according to the data source attribute information of the target data source operation method set, so that the complete mapping relationship between the multi-association objects of the target data source can be determined. The developer does not need to manually sort out the complex mapping relationship, and can intuitively understand the association between each part of the data operation and the data source only by the parsed mapping relationship, which not only reduces the cost and error probability of manual operation, but also promotes the data management under the multi-data source architecture to a more efficient and standardized direction.
[0055] The embodiment of the present application acquires a target data source set composed of multiple target data sources adopted by a target system, performs file scanning according to a target scanning path of the target data source set, and screens target scanning files according to a file scanning result. After determining the target data source set and the target scanning files, a data source operation method included in the target scanning files is parsed to obtain a target data source operation method set corresponding to the target scanning files. Further, the target data source operation method set is parsed in multiple levels according to data source attribute information of the target data source set, and a multi-association object mapping relationship of each target data source is determined according to a multi-level parsing result of the target scanning files. The above scheme solves the defect that the existing database analysis tool cannot establish a multi-association object mapping relationship of data sources in a multi-data source architecture, and can effectively establish the multi-association object mapping relationship of the data sources in the multi-data source architecture.
[0056] Embodiment Three
[0057] Figure 3 is a flowchart of a data mapping relationship determination method provided by the third embodiment of the present application. The present embodiment is based on the above-mentioned embodiments and is further specified. In the present embodiment, multiple specific and optional implementation manners of parsing the target data source operation method set in multiple levels according to the data source attribute information of the target data source set and determining the multi-association object mapping relationship of each target data source according to the multi-level parsing result of the target scanning files are given. Correspondingly, as shown in Figure 3 , the method of the present embodiment can include:
[0058] S310, acquiring a target data source set composed of multiple target data sources adopted by a target system.
[0059] S320, performing file scanning according to a target scanning path of the target data source set, and screening target scanning files according to a file scanning result.
[0060] S330, parsing a data source operation method included in the target scanning files to obtain a target data source operation method set corresponding to the target scanning files.
[0061] S340, determining a data source identifier of each target data source according to data source attribute information of the target data source set.
[0062] The data source identifier of the target data source can be an identifier used to distinguish each target data source.
[0063] In the embodiments of the present application, the data source identifier of each target data source can be determined according to the data source attribute information of the target data source set, so as to determine the mapping relationship between each target data source and each target data source operation method through the data source identifier of the target data source.
[0064] In S350, the hierarchical annotations of each target data source operation method in the target data source operation method set are parsed to obtain a method hierarchical annotation result.
[0065] The hierarchical annotations of the target data source operation method can be an annotation system used to explicitly define the data source operation and the target data source under the multi-data source architecture. For example, the hierarchical annotations of the target data source operation method can include, but are not limited to, method-level annotations and class-level annotations, and the embodiments of the present application do not limit the specific types of the hierarchical annotations of the target data source operation method. The method hierarchical annotation result can be a result obtained by parsing the hierarchical annotations of each target data source operation method. For example, the method hierarchical annotation result can include, but is not limited to, method-level annotation results and class-level annotation results, and the embodiments of the present application do not limit the specific types of the method hierarchical annotation result.
[0066] Specifically, in order to obtain the hierarchical annotations of each target data source operation method, the hierarchical annotations of each target data source operation method in the target data source operation method set can be parsed. Specifically, each target data source operation method in the target data source operation method set can be traversed to determine the Mapper interface class to which each target data source operation method belongs. After determining the Mapper interface class to which each target data source operation method belongs, each target data source operation method can be parsed, so that the method hierarchical annotation result can be obtained.
[0067] In an optional embodiment of the present application, the parsing of the hierarchical annotations of each target data source operation method in the target data source operation method set to obtain the method hierarchical annotation result can include: parsing the method-level annotations of each target data source operation method in the target data source operation method set to obtain a method-level annotation result; and parsing the class-level annotations of each target data source operation method in the target data source operation method set to obtain a class-level annotation result.
[0068] The method-level annotation can be an annotation directly marked on a single method, which is used to specify the specific properties or behaviors of the method. The method-level annotation result can be a result obtained by parsing the method-level annotation. The class-level annotation can be an annotation marked on a class, which is used to set the default properties or behaviors of all members under the class. The class-level annotation result can be a result obtained by parsing the class-level annotation.
[0069] In the embodiment of the present application, in the process of parsing the hierarchical annotations of each target data source operation method in the target data source operation method set to obtain the method hierarchical annotation result, the method-level annotations of each target data source operation method in the target data source operation method set can be parsed, so that the method-level annotation result can be obtained. At the same time, the class-level annotations of each target data source operation method in the target data source operation method set can also be parsed, so that the class-level annotation result can be obtained. After obtaining the method-level annotation result and the class-level annotation result, the method-level annotation result and the class-level annotation result can be taken as the method hierarchical annotation result. In the above scheme, by parsing the hierarchical annotations of each target data source operation method, it can be ensured that the target system can accurately identify the correspondence between each target data source operation method and each target data source through the clear mapping of hierarchical annotations in a complex multi-data source architecture.
[0070] In an optional embodiment of the present application, after the above-mentioned parsing of the hierarchical annotations of each target data source operation method in the target data source operation method set to obtain the method hierarchical annotation result, it can further include: in the case where the method-level annotation result and the class-level annotation result of each target data source operation method exist conflict, obtaining annotation priority configuration information; according to the annotation priority configuration information, screening the conflicting method-level annotation result and class-level annotation result to obtain a target reference annotation result.
[0071] Among them, the annotation priority configuration information can be a rule setting for clearly defining the priority order of different hierarchical annotations in the scenario where multiple hierarchical annotations coexist.
[0072] Specifically, after obtaining the method hierarchical annotation result, the method-level annotation result and the class-level annotation result of the target data source operation method can be compared, and whether there is a conflict between the method-level annotation result and the class-level annotation result of each target data source operation method can be determined according to the comparison result. If the method-level annotation result and the class-level annotation result of the target data source operation method are inconsistent, it can be considered that there is a conflict between the method-level annotation result and the class-level annotation result of the target data source operation method; if the method-level annotation result and the class-level annotation result of the target data source operation method are consistent, it can be considered that there is no conflict between the method-level annotation result and the class-level annotation result of the target data source operation method.
[0073] In a case where the method-level annotation result and the class-level annotation result of each target data source operation method conflict, annotation priority configuration information in the target system can be obtained. Further, the conflicting method-level annotation result and class-level annotation result can be filtered according to the annotation priority configuration information to determine the target reference annotation result. In the above scheme, through the annotation priority configuration information, in the multi-data source architecture, the correspondence between each target data source operation method and the data source can be ensured to be accurately identified, thereby improving the accuracy of data operation. At the same time, the annotation parsing logic can be made clearer, facilitating subsequent maintenance and problem troubleshooting.
[0074] For example, the annotation priority configuration information can be that the method-level annotation is prior to the class-level annotation, and the class-level annotation is prior to the case without annotation. Assuming that the method-level annotation result includes "AAA" and the class-level annotation result includes "BBB", there is a conflict between the method-level annotation result and the class-level annotation result. According to the annotation priority configuration information, it can be determined that the method-level annotation result is prior to the class-level annotation, and therefore the method-level annotation "AAA" can be taken as the target reference annotation result.
[0075] S360, determining a first mapping relationship between each target data source and each target data source operation method according to the data source identifier of each target data source and the method-level annotation result.
[0076] The first mapping relationship can be a correspondence between the target data source and each target data source operation method.
[0077] Specifically, after determining the data source identifier of each target data source and the method-level annotation result, the mapping relationship between each target data source and each target data source operation method can be determined by comparing the data source identifier of each target data source and the method-level annotation result.
[0078] In one specific example, assuming that the method-level annotation result includes "AAA", the target data source corresponding to the target data source operation method corresponding to the method-level annotation is "AAA".
[0079] In an optional embodiment of the present application, the determining of the first mapping relationship between each target data source and each target data source operation method according to the data source identifier of each target data source and the method level annotation result can comprise: determining that the current target data source operation method is a target data source operation method of the main target data source in a case where the method level annotation result or the class level annotation result of the current target data source operation method is the data source identifier of the main target data source, or the method level annotation result and the class level annotation result of the current target data source operation method are both empty; determining that the current target data source operation method is a target data source operation method of the auxiliary target data source in a case where the method level annotation result or the class level annotation result of the current target data source operation method is the data source identifier of the auxiliary target data source.
[0080] The main target data source can be a data source that is preferentially used or used as a main reference in a multi-data source architecture. The auxiliary target data source can be a data source other than the main target data source in the multi-data source architecture. It can be understood that one or more auxiliary target data sources can be included in the target system. The data source identifier can be an identifier used to identify and distinguish data sources.
[0081] In the embodiment of the present application, when the first mapping relationship between each target data source and each target data source operation method is determined according to the data source identifier of each target data source and the method level annotation result, if the method level annotation result or the class level annotation result of the current target data source operation method is the data source identifier of the main target data source, or the method level annotation result and the class level annotation result of the current target data source operation method are both empty, it can be determined that the current target data source operation method is a target data source operation method of the main target data source; if the method level annotation result or the class level annotation result of the current target data source operation method is the data source identifier of the auxiliary target data source, it can be determined that the current target data source operation method is a target data source operation method of the auxiliary target data source. In the above scheme, the data source identifier is used to distinguish whether the target data source operation method is a target data source operation method of the main target data source or a target data source operation method of the auxiliary target data source, which can comprehensively traverse all target data source operation methods and ensure that no related method is missed, thereby providing a clear reference basis for subsequent mapping relationship determination.
[0082] In a specific example, if the method level annotation result of the current target data source operation method is "master", or the method level annotation result of the current target data source operation method is empty and the class level annotation result is "master", or the method level annotation result and the class level annotation result of the current target data source operation method are both empty, it can be determined that the current target data source operation method is a target data source operation method of the main target data source.
[0083] If the method-level annotation result of the current target data source operation method is "AAA", or the method-level annotation result of the current target data source operation method is empty and the class-level annotation result is "AAA", it can be determined that the current target data source operation method is the target data source operation method of the auxiliary target data source AAA.
[0084] If the method-level annotation result of the current target data source operation method is "BBB", or the method-level annotation result of the current target data source operation method is empty and the class-level annotation result is "BBB", it can be determined that the current target data source operation method is the target data source operation method of the auxiliary target data source BBB.
[0085] S370, parse the data source operation statement bound to each target data source operation method to obtain a data table parsing result.
[0086] The data source operation statement can be a command or a statement for performing various operations on the data source. For example, the data source operation statement can include, but is not limited to, a database operation statement, such as an SQL statement. The specific type of data source operation statement is not limited in the embodiment of the application. The data table parsing result can be a parsing result related to the data table obtained by parsing the data source operation statement bound to the target data source operation method.
[0087] Specifically, after determining the first mapping relationship between each target data source and each target data source operation method, the data source operation statement bound to the target data source operation method can be further parsed, so that the data table parsing result can be obtained.
[0088] Optionally, before parsing the data source operation statement bound to the target data source operation method, the data source operation statement can be pre-cleaned to eliminate noise interference and improve the accuracy of subsequent parsing.
[0089] In a specific example, assuming that the data source operation statement is an SQL statement, the <![CDATA[]]> mark and various SQL comments ( / *...* / and —, etc.) can be removed before parsing the SQL statement, so as to avoid interference of irrelevant information on the parsing process.
[0090] After the pre-cleaning of the SQL statement is completed, the SQL statement can be parsed using a regular expression to identify the data table operated by the SQL statement, which can effectively solve the problem of missing table name caused by ${tableName} variable replacement.
[0091] Optionally, the SQL statement defines the data table in various ways, and thus a corresponding regular expression can be formulated for different cases. For example, "(?i)(?:\\bWITH\\s+(\\w+)\\s+AS\\b)" can be used to identify the CTE (Common Table Expressions) temporary table defined by "WITH...AS"; "|(?:\\b(?:FROM|JOIN|INSERT\\s+INTO|UPDATE)\\b\\s+((?:(?:\\w+\\.)?\\w+\\s*(?:,?\\s*))+))" can be used to identify the physical table after "FROM / JOIN / UPDATE"; and "|(\\b\\w+\\b)(?=\\s+AS\\s+$)" can be used to filter the interference information of the data table name.
[0092] It should be noted that the above regular expression has fault tolerance for the comma separator of the data table name. When multiple data table names are separated by a comma, even if different formats are used, such as "table1, table2" with a space after the comma, "table1, table2" with spaces before and after the comma, or other similar heterogeneous separation formats, the regular expression can accurately identify and match the names of the data tables, and will not affect the parsing effect due to the format difference of the separator.
[0093] Optionally, a SQL parsing library can also be used instead of the regular expression to extract the data table name, so as to determine the mapping relationship between each target data source operation method and each data table.
[0094] S380, determining a second mapping relationship between each target data source operation method and each data table according to the data table parsing result of each target data source operation method.
[0095] The second mapping relationship can be a corresponding relationship between each target data source operation method and each data table.
[0096] Correspondingly, after the data source operation statement bound to each target data source operation method is parsed to obtain the data table parsing result, the data table operated by each target data source operation method can be determined according to the data table parsing result of each target data source operation method, and thus the second mapping relationship between each target data source operation method and each data table can be determined.
[0097] S390, determining a multi-association object mapping relationship of each target data source according to the first mapping relationship and the second mapping relationship.
[0098] Correspondingly, after determining the first mapping relationship between each target data source and each target data source operation method, and the second mapping relationship between each target data source operation method and each data table, the mapping relationship between each target data source, each target data source operation method, each data source operation statement bound by each target data source operation method, and each data table can be determined according to the first mapping relationship and the second mapping relationship, so as to establish a complete mapping relationship among the target data source-target data source operation method-data source operation statement bound by the target data source operation method-data table, thereby providing core support for data source decoupling and localization adaptation evaluation in the Xinchuang migration.
[0099] Optionally, after determining the multi-association object mapping relationship of each target data source, the name of the data table can be normalized to eliminate the problem of data case sensitivity.
[0100] The embodiment of the application obtains a target data source set composed of multiple target data sources adopted by a target system, performs file scanning according to a target scanning path of the target data source set, and screens target scanning files according to a file scanning result. After determining the target data source set and the target scanning files, the data source operation methods included in the target scanning files are parsed to obtain a target data source operation method set corresponding to the target scanning files. Further, the data source identifiers of each target data source are determined according to the data source attribute information of the target data source set, and the hierarchical annotations of each target data source operation method in the target data source operation method set are parsed to obtain a method hierarchical annotation result. After obtaining the data source identifiers of each target data source and the method hierarchical annotation result, the first mapping relationship between each target data source and each target data source operation method is determined according to the data source identifiers of each target data source and the method hierarchical annotation result. Further, the data source operation statements bound by each target data source operation method are parsed to obtain a data table parsing result. After obtaining the data table parsing result, the second mapping relationship between each target data source operation method and each data table is determined according to the data table parsing result of each target data source operation method, so as to determine the multi-association object mapping relationship of each target data source according to the first mapping relationship and the second mapping relationship. The above scheme solves the defect that the existing database analysis tool cannot establish the multi-association object mapping relationship of the data source in the multi-data source architecture, and can effectively establish the multi-association object mapping relationship of the data source in the multi-data source architecture.
[0101] In the technical scheme of the present disclosure, the collected information is information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards of relevant countries and regions, necessary security measures are taken, public order and good customs are not violated, and appropriate operation portals are provided for users to choose authorization or refusal.
[0102] It should be noted that in the embodiments of the present application, a corresponding operation portal can be provided for the user to select to agree or reject the automatic decision result; if the user selects to reject, the expert decision process is entered.
[0103] It should be noted that any arrangement and combination of the technical features in the above embodiments also belong to the protection scope of the present application.
[0104] Embodiment Four
[0105] Figure 4 is a schematic diagram of a data mapping relationship determination device provided by an embodiment of the present application, as shown in Figure 4 The device comprises a target data source set acquisition module 410, a target scanning file screening module 420 and a multi-association object mapping relationship determination module 430, wherein:
[0106] The target data source set acquisition module 410 is configured to acquire a target data source set composed of multiple target data sources adopted by a target system.
[0107] The target scanning file screening module 420 is configured to perform file scanning according to a target scanning path of the target data source set, and screen a target scanning file according to a file scanning result.
[0108] The multi-association object mapping relationship determination module 430 is configured to analyze the target scanning file according to data source attribute information of the target data source set, and determine a multi-association object mapping relationship of each target data source according to an analysis result of the target scanning file.
[0109] The embodiment of the present application acquires a target data source set composed of multiple target data sources adopted by a target system, performs file scanning according to a target scanning path of the target data source set, and screens a target scanning file according to a file scanning result. After the target data source set and the target scanning file are determined, the target scanning file is analyzed according to data source attribute information of the target data source set, and a multi-association object mapping relationship of each target data source is determined according to an analysis result of the target scanning file. The above scheme solves the defect that the existing database analysis tool cannot establish a multi-association object mapping relationship of a data source in a multi-data source architecture, and can effectively establish a multi-association object mapping relationship of a data source in a multi-data source architecture.
[0110] Optionally, the target scanning file screening module 420 is specifically configured to perform file scanning according to a target scanning path of the target data source set to obtain a scanning file set under the target scanning path, and screen the scanning file set according to a feature identifier of the target scanning file to obtain the target scanning file.
[0111] Optionally, the multi-correlation object mapping relationship determining module 430 is specifically configured to: parse a data source operation method included in the target scanning file to obtain a target data source operation method set corresponding to the target scanning file; perform multi-level parsing on the target data source operation method set according to data source attribute information of the target data source set, and determine the multi-correlation object mapping relationship of each target data source according to a multi-level parsing result of the target scanning file.
[0112] Optionally, the multi-correlation object mapping relationship determining module 430 is further configured to: determine a data source identifier of each target data source according to data source attribute information of the target data source set; parse a level annotation of each target data source operation method in the target data source operation method set to obtain a method level annotation result; determine a first mapping relationship between each target data source and each target data source operation method according to the data source identifier of each target data source and the method level annotation result; parse a data source operation statement bound to each target data source operation method to obtain a data table parsing result; determine a second mapping relationship between each target data source operation method and each data table according to the data table parsing result of each target data source operation method; and determine the multi-correlation object mapping relationship of each target data source according to the first mapping relationship and the second mapping relationship.
[0113] Optionally, the multi-correlation object mapping relationship determining module 430 is further configured to: parse a method level annotation of each target data source operation method in the target data source operation method set to obtain a method level annotation result; and parse a class level annotation of each target data source operation method in the target data source operation method set to obtain a class level annotation result.
[0114] Optionally, the multi-correlation object mapping relationship determining module 430 is further configured to: determine that a current target data source operation method is a target data source operation method of a main target data source in a case where the method level annotation result or the class level annotation result of the current target data source operation method is a data source identifier of the main target data source, or in a case where the method level annotation result and the class level annotation result of the current target data source operation method are both empty; and determine that the current target data source operation method is a target data source operation method of an auxiliary target data source in a case where the method level annotation result or the class level annotation result of the current target data source operation method is a data source identifier of the auxiliary target data source.
[0115] Optionally, the apparatus can further include a target reference annotation result determination module configured to, in a case where the method-level annotation result and the class-level annotation result of each of the target data source operation methods conflict, obtain annotation priority configuration information; and filter the conflicting method-level annotation result and class-level annotation result according to the annotation priority configuration information to obtain a target reference annotation result.
[0116] The data mapping relationship determination apparatus can execute the data mapping relationship determination method provided by any embodiment of the present application, and has the corresponding function modules and beneficial effects of executing the method. Technical details not described in the embodiment can be referred to the data mapping relationship determination method provided by any embodiment of the present application.
[0117] Since the data mapping relationship determination apparatus described above is an apparatus that can execute the data mapping relationship determination method in the embodiments of the present application, based on the data mapping relationship determination method described in the embodiments of the present application, those skilled in the art can understand the specific implementation of the data mapping relationship determination apparatus of the embodiments and various changes thereof, so the data mapping relationship determination apparatus how to implement the data mapping relationship determination method in the embodiments of the present application will not be described in detail here. As long as the apparatus used to implement the data mapping relationship determination method in the embodiments of the present application is implemented by those skilled in the art, it belongs to the scope of the present application.
[0118] Embodiment Five
[0119] Figure 5 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0120] As Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication. The memory stores a computer program executable by the at least one processor 11, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded into the random access memory (RAM) 13 from the storage unit 18. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0121] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0122] The processor 11 can be various general-purpose and / or special-purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the data mapping relationship determination method.
[0123] In some embodiments, the data mapping relationship determination method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data mapping relationship determination method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the data mapping relationship determination method by any other appropriate means, such as by means of firmware.
[0124] Optionally, the data mapping relationship determination method can comprise: obtaining a target data source set composed of multiple target data sources adopted by a target system; performing file scanning according to a target scanning path of the target data source set, and screening target scanning files according to a file scanning result; analyzing the target scanning files according to data source attribute information of the target data source set, and determining multiple correlation object mapping relationships of each target data source according to an analysis result of the target scanning files.
[0125] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0126] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor of the machine, implements the functions / acts specified in the flow diagrams and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0127] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0128] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0129] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0130] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0131] It should be understood that the various forms of flow shown above can be reordered, steps added or removed. For example, the steps described in the present disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions of the present disclosure can be achieved, which are not limited herein.
[0132] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A data mapping relationship determination method, characterized in that, The method comprises the following steps: acquiring a target data source set composed of multiple target data sources adopted by a target system; performing file scanning according to a target scanning path of the target data source set, and screening target scanning files according to a file scanning result; analyzing the target scanning files according to data source attribute information of the target data source set, and determining a multi-correlation object mapping relationship of each target data source according to an analysis result of the target scanning files.
2. The method of claim 1, wherein, The method of performing file scanning according to a target scanning path of the target data source set, and screening target scanning files according to a file scanning result, comprises the following steps: performing file scanning according to a target scanning path of the target data source set, and obtaining a scanning file set under the target scanning path; screening the scanning file set according to a characteristic identifier of the target scanning file, and obtaining the target scanning file.
3. The method of claim 1, wherein, The method of analyzing the target scanning files according to data source attribute information of the target data source set, and determining a multi-correlation object mapping relationship of each target data source according to an analysis result of the target scanning files, comprises the following steps: analyzing a data source operation method included in the target scanning file, and obtaining a target data source operation method set corresponding to the target scanning file; performing multi-level analysis on the target data source operation method set according to data source attribute information of the target data source set, and determining a multi-correlation object mapping relationship of each target data source according to a multi-level analysis result of the target scanning file.
4. The method of claim 3, wherein, The method of performing multi-level analysis on the target data source operation method set according to data source attribute information of the target data source set, and determining a multi-correlation object mapping relationship of each target data source according to a multi-level analysis result of the target scanning file, comprises the following steps: determining a data source identifier of each target data source according to data source attribute information of the target data source set; analyzing a level annotation of each target data source operation method in the target data source operation method set, and obtaining a method level annotation result; determining a first mapping relationship between each target data source and each target data source operation method according to the data source identifier of each target data source and the method level annotation result; analyzing a data source operation statement bound to each target data source operation method, and obtaining a data table analysis result; determining a second mapping relationship between each target data source operation method and each data table according to the data table analysis result of each target data source operation method; determining a multi-correlation object mapping relationship of each target data source according to the first mapping relationship and the second mapping relationship.
5. The method of claim 4, wherein, The method of analyzing a level annotation of each target data source operation method in the target data source operation method set, and obtaining a method level annotation result, comprises the following steps: analyzing a method level annotation of each target data source operation method in the target data source operation method set, and obtaining a method level annotation result; analyzing a class level annotation of each target data source operation method in the target data source operation method set, and obtaining a class level annotation result.
6. The method of claim 5, wherein, The first mapping relationship between each target data source and each target data source operation method is determined according to the data source identifier of each target data source and the method level annotation result, and the first mapping relationship comprises: In a case where it is determined that the method level annotation result or the class level annotation result of the current target data source operation method is the data source identifier of the main target data source, or it is determined that the method level annotation result and the class level annotation result of the current target data source operation method are both empty, it is determined that the current target data source operation method is the target data source operation method of the main target data source. In a case where it is determined that the method level annotation result or the class level annotation result of the current target data source operation method is the data source identifier of the auxiliary target data source, it is determined that the current target data source operation method is the target data source operation method of the auxiliary target data source.
7. The method according to claim 5 or 6, characterized in that, After the hierarchical annotation of each target data source operation method in the target data source operation method set is parsed to obtain the method level annotation result, the method further comprises: In a case where it is determined that the method level annotation result and the class level annotation result of each target data source operation method are in conflict, annotation priority configuration information is obtained. According to the annotation priority configuration information, the method level annotation result and the class level annotation result in conflict are screened to obtain a target reference annotation result.
8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data mapping relationship determination method in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to execute the data mapping relationship determination method in any one of claims 1-7 when executed.
10. A computer program product comprising computer programs / instructions, wherein, The computer program / instructions enable the processor to execute the data mapping relationship determination method in any one of claims 1-7 when executed.
Citation Information
Cited By
Multi-source heterogeneous data set-oriented data relationship modeling method and device and storage medium
CN121858784A