CN115712637A - Table name query method and device, electronic equipment and readable storage medium - Google Patents

Table name query method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115712637A
CN115712637A CN202211325487.1A CN202211325487A CN115712637A CN 115712637 A CN115712637 A CN 115712637A CN 202211325487 A CN202211325487 A CN 202211325487A CN 115712637 A CN115712637 A CN 115712637A
Authority
CN
China
Prior art keywords
field
user interface
window
target
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211325487.1A
Other languages
Chinese (zh)
Inventor
杨佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Financial Technology Co Ltd
Original Assignee
Bank of China Financial Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Financial Technology Co Ltd filed Critical Bank of China Financial Technology Co Ltd
Priority to CN202211325487.1A priority Critical patent/CN115712637A/en
Publication of CN115712637A publication Critical patent/CN115712637A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application discloses a table name query method, a table name query device, electronic equipment and a readable storage medium, which can be applied to the financial field or other fields. Acquiring a configuration file, and determining a user interface at the position of the current external circulation times in the first sequence as a target user interface; entering the target user interface through the url of the target user interface; determining a window located at the position of the current internal circulation times in a second sequence corresponding to the target user interface as a target window; determining the position of the field in the target window through the relative path of the field contained in the target window; assigning a preset field value to the field in the target window; obtaining a request for querying a table name of a table to which the field belongs in the target window; acquiring a log file corresponding to the request; and obtaining the table name of the table to which the field belongs from the sql statement contained in the log file, thereby realizing automatic query operation and saving time and labor.

Description

Table name query method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of internet, and more particularly, to a table name query method and apparatus, an electronic device, and a readable storage medium.
Background
The financial field relates to a plurality of services, and during the process of transaction, or before transaction, or after transaction, operations may need to be performed on fields related to one or more tables corresponding to the services, for example, inserting new fields into the tables or deleting existing fields or updating existing fields. Before operating on the field to which the table refers, the table to which the field belongs needs to be queried. For example, if a field of "customer contact address" is to be added to a table containing a field "customer number", a table to which the "customer number" belongs needs to be queried first, and if the table to which the "customer number" belongs is queried is a "customer table", a corresponding sql statement (Structured Query Language) needs to be written, and the sql statement is used for adding the field "customer contact address" to the "customer table".
At present, the table to which the query field belongs is manually queried, which is time-consuming and labor-consuming.
Disclosure of Invention
In view of this, the present application provides a table name query method, apparatus, electronic device, and readable storage medium.
In order to achieve the above purpose, the present application provides the following technical solutions:
a first aspect of the present application provides a table name query method, including:
acquiring a configuration file, wherein the configuration file comprises a url corresponding to each of a plurality of user interfaces, a first sequence, a url of a window contained in each of the user interfaces, a second sequence corresponding to each of the user interfaces, a relative path of each of the fields in the window, and a preset field value corresponding to each of the fields, the first sequence refers to a plurality of user interface sequences, and the second sequence corresponding to the user interfaces is a window sequence contained in the user interfaces;
determining a user interface at a position of the current outer loop times in the first sequence as a target user interface;
entering the target user interface through the url of the target user interface;
determining a window located at the position of the current internal circulation times in a second sequence corresponding to the target user interface as a target window;
entering the target window through the url address of the target window;
determining the position of the field in the target window through the relative path of the field contained in the target window;
assigning the preset field value to the field in the target window;
obtaining a request for querying a table name of a table to which the field belongs in the target window;
acquiring a log file corresponding to the request, wherein the log file comprises an sql statement corresponding to the field in the target window, and the sql statement corresponding to the field comprises a table name of a table to which the field belongs;
obtaining the table name of the table to which the field belongs from the sql statement contained in the log file;
returning to the step of determining that the window located at the position of the current internal circulation times in the second sequence corresponding to the target user interface is the target window until the target window is the last position in the second sequence corresponding to the target user interface;
and returning to the step of determining that the user interface at the position of the current outer circulation times in the first sequence is the target user interface until the target user interface is the last position in the first sequence.
With reference to the first aspect, in a first possible implementation manner, the step of obtaining, from the sql statement included in the log file, a table name of a table to which the field belongs includes:
acquiring a preset matching rule, wherein the matching rule contains a special character, and the name behind the special character in the matching rule is a table name;
and if the sql statement conforms to the matching rule, determining that the name behind the special character in the sql statement is the table name of the table to which the field belongs.
With reference to the first aspect, in a first possible implementation manner, the method further includes:
storing the table names of the tables to which the fields belong into a file;
converting the file into a file with a dataframe format, wherein the file with the dataframe format comprises a corresponding relation between fields and table names of tables to which the fields belong, a plurality of the fields form a column, the table names of the tables to which the fields belong form a column, and the columns to which the fields belong are index columns;
obtaining an excel file through the dataframe format file, wherein the excel file comprises corresponding relations between fields and table names of tables to which the fields belong, and a plurality of the fields form a column and a plurality of the table names of the tables to which the fields belong form a column.
With reference to the first aspect, in a first possible implementation manner, the method further includes:
and if the name behind the special character in the sql statement does not exist, storing the sql statement as the table name to which the field belongs into the file.
With reference to the first aspect, in a first possible implementation manner, the method further includes:
and displaying the table name of the table to which the field belongs on the user interface.
A second aspect of the present application provides a table name query apparatus, including:
a first obtaining unit, configured to obtain a configuration file, where the configuration file includes url (uniform resource locator) information, a first order, url of a window included in each user interface, a second order corresponding to each user interface, a relative path of each field in the window, and a preset field value corresponding to each field, where the first order refers to a plurality of user interface orderings, and the second order corresponding to the user interfaces is a window ordering included in the user interfaces;
a first determining unit, configured to determine that a user interface located at a position of a current outer loop number in the first order is a target user interface;
the first entering unit is used for entering the target user interface through the url of the target user interface;
a second determining unit, configured to determine that a window located at a position of the current inner loop times in a second sequence corresponding to the target user interface is a target window;
the second entering unit is used for entering the target window through the url address of the target window;
a third determining unit, configured to determine, through a relative path of the field included in the target window, a position of the field located in the target window;
an assigning unit, configured to assign the preset field value to the field in the target window;
a second obtaining unit, configured to obtain a request for querying a table name of a table to which the field belongs in the target window;
a third obtaining unit, configured to obtain a log file corresponding to the request, where the log file includes a structured query language sql statement corresponding to the field in the target window, and the sql statement corresponding to the field includes a table name of a table to which the field belongs;
an obtaining unit, configured to obtain, from the sql statement included in the log file, a table name of a table to which the field belongs;
the first returning unit is used for returning to the second determining unit until the target window is the last in the second sequence corresponding to the target user interface;
and the second returning unit is used for returning to the first determining unit until the target user interface is the last bit in the first sequence.
With reference to the second aspect, in a first possible implementation manner, the obtaining unit includes:
the system comprises an acquisition module, a matching module and a display module, wherein the acquisition module is used for acquiring a preset matching rule, the matching rule contains special characters, and the name behind the special characters in the matching rule is a table name;
and the determining module is used for determining that the name behind the special character in the sql statement is the table name of the table to which the field belongs if the sql statement conforms to the matching rule.
With reference to the second aspect, in a first possible implementation manner, the method further includes:
the first storing module is used for storing the table names of the tables to which the fields belong into a file;
the conversion module is used for converting the file into a file in a dataframe format, wherein the file in the dataframe format comprises a corresponding relation between fields and table names of tables to which the fields belong, a plurality of the fields form a column, the table names of the tables to which the fields belong form a column, and the column in which the fields belong is an index column;
an obtaining module, configured to obtain an excel file from the dataframe-formatted file, where the excel file includes a correspondence between fields and table names of tables to which the fields belong, and a plurality of the fields form a column and a plurality of the table names of the tables to which the fields belong form a column.
A third aspect of the present application provides an electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the table name query method as described in any one of the above.
A fourth aspect of the present application provides a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the table name query method as described in any one of the above.
According to the technical scheme, the table name query method includes the steps that firstly, a configuration file is obtained, the configuration file comprises uniform resource locators url corresponding to a plurality of user interfaces respectively, a first sequence, a window url contained in each user interface, a second sequence corresponding to each user interface, a relative path of each field located in the window and a preset field value corresponding to each field, the first sequence refers to sequencing of the user interfaces, and the second sequence corresponding to the user interfaces is sequencing of the windows contained in the user interfaces. Firstly, determining a target user interface, determining the user interface at the position of the current external circulation times in the first sequence as the target user interface, and entering the target user interface through url of the target user interface; secondly, determining a target window, determining a window located at the position of the current internal circulation times in a second sequence corresponding to the target user interface as the target window, and entering the target window through the url address of the target window; after entering the target window, the position of the field in the target window needs to be determined by the relative path of the field contained in the target window.
If the position of a field in the target window is determined, a preset field value can be assigned to the field, a request for inquiring the table name of the table to which the field in the target window belongs is obtained, and further a log file corresponding to the request can be obtained; the log file comprises sql statements corresponding to fields in a target window, and the sql statements corresponding to the fields comprise table names of tables to which the fields belong; the table names of the tables to which the fields belong can be obtained from the sql statement contained in the log file, so that the table names of the tables to which all the fields in the current target window belong can be obtained. And returning to the step of determining that the window positioned at the position of the current internal circulation times in the second sequence corresponding to the target user interface is the target window until the target window is the last position in the second sequence corresponding to the target user interface, so that the table names of the tables to which all fields in all windows contained in the current target user interface belong can be obtained. And returning to the step of determining that the user interface at the position of the current outer loop times in the first sequence is the target user interface until the target user interface is the last position in the first sequence, so that the table names of the tables to which all fields in all windows contained in all the target user interfaces belong can be obtained. Therefore, if the table name of the table to which the field belongs is required to be inquired, automatic inquiry operation can be realized, manual inquiry operation is not required, and time and labor are effectively saved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a block diagram of a hardware architecture in accordance with an exemplary embodiment;
FIG. 2 is a flowchart of a table name lookup method provided in accordance with an exemplary embodiment;
FIG. 3 is a schematic illustration of a user interface provided in accordance with an exemplary embodiment;
FIG. 4 is a schematic illustration of field locations of a user interface provided in accordance with an exemplary embodiment;
FIG. 5 is a diagram providing a table name display of a table to which a field belongs in accordance with an illustrative embodiment;
FIG. 6 is a block diagram of a table name lookup apparatus provided in accordance with an exemplary embodiment;
FIG. 7 is a block diagram of an electronic device apparatus provided in accordance with an example embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The embodiment of the application provides a table name query method, a table name query device, an electronic device and a readable storage medium, and before introducing the technical scheme provided by the embodiment of the application, a hardware architecture related to the application is explained.
As shown in fig. 1, a schematic diagram of a hardware architecture provided in the embodiment of the present application includes, but is not limited to: an electronic device 11 and a server 12.
For example, the electronic device 11 may be any electronic product that can interact with a user through one or more ways such as a keyboard, a touch pad, a touch screen, a remote controller, a voice interaction device, or a handwriting device, for example, a mobile phone, a tablet computer, a palm computer, a personal computer, or the like.
The server 12 may be a server, a server cluster composed of a plurality of servers, or a cloud computing service center.
Illustratively, the electronic device 11 runs an application for analyzing transaction data.
Illustratively, there is a table in the server 12 for storing transaction data.
Illustratively, the user may query the table to which the fields contained in the window in the user interface in the application belong through the electronic device 11.
The electronic device 11 runs an application program, and the application program includes a plurality of user interfaces, each user interface includes one or more windows, and each window includes a plurality of fields.
In the related art, a user may fill in a field value of a field in a window displayed by the electronic device 11, then click a corresponding button to obtain a request for querying a table name of a table to which the field belongs, the electronic device 11 sends the request for querying the table name of the table to which the field belongs to the server 12, the server 12 processes the request for querying the table name of the table to which the field belongs to obtain a log file corresponding to the request, and the user may manually find a service layer and a dao layer corresponding to the field by one layer through the log file, then find an sql statement including the field, and finally need to find the table name of the table to which the field belongs from the sql statement. The above method of acquiring the table name of the table to which the field belongs needs to manually perform a series of operations, and is time-consuming and labor-consuming.
Based on this, the present application discloses a table name query method, which can automatically execute the above operations through the electronic device 11 to obtain the table name of the table to which the field belongs, without human operation.
It will be understood by those skilled in the art that the foregoing electronic devices or servers are merely exemplary and that other electronic devices or servers, now known or later developed, that may be suitable for use in the present disclosure are also included within the scope of the present disclosure and are hereby incorporated by reference.
A table name query method provided in the embodiment of the present application is described below with reference to the hardware architecture.
Referring to fig. 2, fig. 2 is a flowchart of a table name query method provided according to an exemplary embodiment, which includes the following steps S201 to S212 in implementation.
Step S201: the method comprises the steps of obtaining a configuration file, wherein the configuration file comprises uniform resource locators url corresponding to a plurality of user interfaces respectively, a first sequence, the url of a window contained in each user interface, a second sequence corresponding to each user interface, a relative path of each field located in the window and a preset field value corresponding to each field, the first sequence refers to the sequencing of the user interfaces, and the second sequence corresponding to the user interfaces is the sequencing of the windows contained in the user interfaces.
The contents contained in the configuration file will be described below.
A Universal Resource Locator (url), also called a web address, is an address of a standard Resource on the internet. Each user interface or window on the internet has a unique url that contains information indicating the location of the user interface or window and how the application should handle it. Each user interface has a unique url, and each window has a unique url.
The first order is a switching order of the plurality of user interfaces. The ordering of the plurality of user interfaces pointed by the first order may be the ordering of the identifiers of the plurality of user interfaces, or the ordering of the urls corresponding to the plurality of user interfaces respectively; the following examples are given.
As shown in fig. 3, the number of the plurality of user interfaces is 6, the plurality of user interfaces are respectively "information query", "transaction history", "suspicious case query", "large-amount case query", "message query", and "delivery result query", and if the sequence of obtaining the table names of the tables to which the fields in the user interfaces belong is: information query, transaction history, suspicious case query, large-amount case query, message query and delivery result query, the first sequence is { information query, transaction history, suspicious case query, large-amount case query, message query and delivery result query }. According to the first sequence, after the table names of the tables to which the fields contained in all the windows contained in the user interface information query belong are obtained, switching to the user interface transaction history, continuously querying the table names of the tables to which the fields contained in the windows contained in the user interface transaction history belong, and so on.
The second sequence corresponding to each user interface is a switching sequence of the windows included in each user interface, and the second sequence corresponding to each user interface may be a sequence of the identifiers of the windows included in the user interface or a sequence of the urls of the windows included in the user interface. The following examples are given.
Each user interface comprises one or more windows, for example, the user interface "information query" comprises a window "query", a window "submit export job", a window "flow record", a window "screen" and a window "case report record", it can be understood that the corresponding window can be opened only by triggering the corresponding button, for example, the button "query" in the user interface "information query" is triggered, and the "query" window can be opened; triggering a button 'submit export job' in a user interface 'information query', and opening a 'submit export job' window; triggering a button 'process record' in a user interface 'information query', and opening a 'process record' window; triggering a button 'screening' in a user interface 'information query', and opening a 'screening' window; triggering a button 'process record' in a user interface 'information query', and opening a 'process record' window; the button "case submission record" in the user interface "information query" is triggered, and a "case submission record" window can be opened. If the second sequence corresponding to the user interface 'information query' is { query, submission and export operation, flow record, screening, case report record }, according to the second sequence corresponding to the user interface 'information query', after the table names of the tables to which the fields contained in the 'information query' belong are queried, the table names of the tables to which the fields contained in the 'submission and export operation' belong can be queried, and the like.
For example, fig. 3 is only an example, and the content and form of the user interface presentation are not limited herein.
For example, if the number of the user interfaces is 3, the identities of the 3 user interfaces are url1, url2, and url3 of the user interfaces 3,3, respectively, the first order may be { user interface 1, user interface 2, user interface 3} or { url1, url2, url3}.
The identification of the user interface is merely an example, and the type and form of the identification of the user interface are not limited herein.
The "relative path of the field at the window" may be: the position of a reference point in the window is used as a reference position, and the position area of the reference position is included in the field. The relative path of the field in the window is used to locate where the field is located in the window. For example, a "relative path with a field located in a window" may be characterized by a field id or field name or a field located in a window relative to a reference location.
If the 'relative path of the field in the window' is characterized by the field id, the configuration file also needs to include the corresponding relationship between the field id corresponding to the preset field and the position area of the field in the window relative to the reference position; if the "relative path of the field in the window" is characterized by the field name, the configuration file further needs to include a correspondence between the field name corresponding to the preset field and the position area of the field in the window relative to the reference position. The following examples are given.
For example, if the reference position is the top left vertex of the window, the "position region of the field with respect to the reference position" is the coordinates of the position region where the field is located with the top left vertex of the window as the origin.
The preset field value corresponding to each field is a field value preset by a user according to actual conditions.
For example, the preset field value corresponding to the field "case type" is an anti-money laundering type; the field "case number" corresponds to a preset field value of "0001".
Step S202: and determining the user interface at the position of the current outer circulation times in the first sequence as a target user interface.
For example, the process from step S202 to step S211 is regarded as an outer loop, and each time the process from step S202 to step S211 is performed, the current number of outer loops is added to the number of outer loops of the previous process, and for example, when the process from step S202 to step S211 is performed for the first time, the current number of outer loops has a value of 1.
For example, if the current outer loop is the nth time, the nth user interface in the first sequence is determined as the target user interface. For example, if the current outer loop times is the first time, determining that the first user interface in the first sequence is the target user interface; and if the current external circulation times are the third time, determining that the third user interface in the first sequence is the target user interface, and so on.
Step S203: and entering the target user interface through the url of the target user interface.
For example, if the first order is a sequence of the identifiers of the multiple user interfaces, the configuration file further needs to include a preset correspondence between the identifier of the user interface and the url of the user interface. After the target user interface is determined, the url of the target user interface needs to be acquired from the corresponding relation between the identifier of the user interface and the url of the user interface, and then the step of entering the target user interface through the url of the target user interface can be executed.
For example, if the first order is a ranking of urls of the plurality of user interfaces, the step of entering the target user interface through the urls of the target user interface may be performed directly after the target user interface is determined.
Step S204: and determining the window positioned at the current inner circulation frequency position in the second sequence corresponding to the target user interface as a target window.
For example, the process from step S204 to step S210 is regarded as one internal loop, and each time the process from step S204 to step S210 is performed, the current number of internal loops is increased by one based on the number of internal loops of the previous process, and for example, when the process from step S204 to step S210 is performed for the first time, the current number of internal loops is 1.
Illustratively, if the current number of times of the inner loop is nth, determining that the nth window in the second sequence corresponding to the target user interface is the target window. For example, if the current internal cycle number is the first time, determining that a first window in a second sequence corresponding to the target user interface is a target window; and if the current internal circulation times are the third time, determining that the third window in the second sequence corresponding to the target user interface is the target window, and so on.
Illustratively, the target user interface contains one or more windows.
Step S205: and entering the target window through the url address of the target window.
Illustratively, if the second sequence corresponding to the target user interface is a sequence of the identifiers of the one or more windows included in the target user interface, the configuration file further needs to include a preset correspondence between the identifier of the window and the url of the window. After the target window is determined, the url of the target window needs to be obtained from the corresponding relationship between the window identifier and the url of the window, and the step of entering the target window through the url of the target window can be executed.
For example, if the second order corresponding to the target user interface is the order of the urls of one or more windows included in the target user interface, after the target window is determined, the step of entering the target window through the urls of the target window may be directly performed.
Step S206: determining the position of the field in the target window through the relative path of the field contained in the target window.
For example, as shown in fig. 3, which is a schematic diagram of a target window, the reference position of the window is the top left vertex of the window, and the relative path of the field "case type" is: coordinates of a position area where a field 'case type' is located by taking the top left vertex of the window as an origin; the position of the field can be determined by the coordinates of the location area where the field is located as shown in fig. 4.
Step S207: and assigning the preset field value to the field in the target window.
For example, the window includes a plurality of fields, and the preset field values corresponding to the plurality of fields may be assigned to the corresponding fields at the same time, or the preset field value corresponding to each field may be assigned to each field in sequence, and then the preset field value corresponding to the next field is assigned to the next field, and so on.
For example, as shown in fig. 3, if the preset field value corresponding to the field "case type" is "suspicious", the preset field value "suspicious" is assigned to the field "case type", that is, the field value is assigned in the input box corresponding to the field "case type".
Step S208: obtaining a request for querying a table name of a table to which the field belongs in the target window.
For example, the request for obtaining the table name for querying the table to which the field in the target window belongs includes, but is not limited to, two cases: in the first case, the preset field values corresponding to the fields are assigned to the corresponding fields at the same time, and then a request for querying the table names of the tables to which the fields belong is obtained at the same time; in the second case, the preset field value corresponding to one field may be assigned to the field, and then the request for querying the table name of the table to which the field belongs is obtained, and then the preset field value corresponding to the next field is assigned to the next field, and the request for querying the table name of the table to which the next field belongs is obtained, and so on.
It will be appreciated that after assigning a predetermined field value to a field in the target window, a corresponding button needs to be triggered to generate a request for querying the table name of the table to which the field belongs. For example, as shown in fig. 3, in the example of step S207, after the preset field value "suspicious" is assigned to the field "case type", the "query" button as shown in the figure needs to be triggered to generate the request for querying the table name of the table to which the field "case type" belongs.
For example, the "query" button shown in fig. 3 is only an example, and different windows may obtain requests for querying the table name of the table to which the field belongs, and the buttons to be triggered may be different or the same.
In an alternative implementation manner, there are various methods for implementing automatic button triggering, and the embodiments of the present application provide, but are not limited to, the following two methods.
The first method for realizing automatic button triggering comprises the following steps: the electronic device 11 may implement automatically triggering the corresponding button by executing the pre-written code to obtain a request for querying the table name of the table to which the field in the target window belongs.
A second method for realizing automatic button triggering comprises the following steps: clicking the corresponding button to obtain a request for querying the table name of the table to which the field in the target window belongs may be implemented using RPA Robot Process Automation (RPA).
Among these, the robot process automation software is an application that provides another way to automate a user's manual process by mimicking the user's manual process at a computer. Instead of the user performing the operation of clicking the corresponding button, RPA robot flow automation software may be used.
Step S209: and acquiring a log file corresponding to the request, wherein the log file comprises an sql statement corresponding to the field in the target window, and the sql statement corresponding to the field comprises a table name of a table to which the field belongs.
For example, after obtaining a plurality of requests for querying table names of tables to which a plurality of fields in the target window respectively belong, the plurality of requests may be transmitted to the server 12 to obtain logs corresponding to the plurality of requests, the logs corresponding to the plurality of requests may be stored in one log file, the logs corresponding to the plurality of requests may be stored in different log files, and the log files may be stored in a preset folder.
Step S210: and obtaining the table name of the table to which the field belongs from the sql statement contained in the log file.
It is to be understood that the sql statement included in the log file includes table names of tables to which fields belong, and in order to more quickly and automatically screen the table names of tables to which each field in the sql statement belongs, the embodiments of the present application provide, but are not limited to, the following methods.
Step A11: the method comprises the steps of obtaining a preset matching rule, wherein the matching rule contains special characters, and names behind the special characters in the matching rule are table names.
For example, the preset matching rule may be a preset regular expression, and the special character included in the matching rule may be from; when the special character is from, the rule represented by the preset regular expression is as follows: the names after from are table names.
Step A12: and if the sql statement conforms to the matching rule, determining that the name behind the special character in the sql statement is the table name of the table to which the field belongs.
For example, if the sql statement conforms to a preset regular expression, the regular expression may be used to match the table name of the table to which the field included in the sql statement belongs, that is, the name after the special character from is determined to be the table name of the table to which the field belongs. If the table to which the field belongs is multiple, that is, the field exists in multiple tables, the regular expression can be used to repeatedly match the sql statement corresponding to the field multiple times, so as to obtain multiple tables to which the field belongs.
Step S211: judging whether the target window is the last in the second sequence corresponding to the target user interface, if so, executing step S212; if not, the process returns to step S204.
For example, if the target window is the last in the second sequence corresponding to the target user interface, it indicates that all windows included in the target user interface have executed the above step of inner loop, and the table name of the table to which each field in all windows included in the current target user interface belongs is found, at this time, step S212 needs to be executed.
For example, if the target window is not the last in the second sequence corresponding to the target user interface, it indicates that there is a window that does not execute the inner loop step in the windows included in the target user interface, and at this time, the process needs to return to step S204.
Step S212: judging whether the target user interface is the last in the first sequence or not, if so, ending; if not, the process returns to step S202.
Illustratively, if the target ui is the last in the first sequence, it indicates that all windows included in all the uis have performed the above outer loop, and the table name of the table to which each field in all the windows included in all the uis belongs is found.
For example, if the target user interface is not the last in the first sequence, it indicates that there is a user interface that has not executed the outer loop step, and in this case, it needs to return to step S202.
According to the technical scheme, the table name query method includes the steps that firstly, a configuration file is obtained, the configuration file comprises uniform resource locators url corresponding to a plurality of user interfaces respectively, a first sequence, a window url contained in each user interface, a second sequence corresponding to each user interface, a relative path of each field located in the window and a preset field value corresponding to each field, the first sequence refers to sequencing of the user interfaces, and the second sequence corresponding to the user interfaces is sequencing of the windows contained in the user interfaces. Firstly, determining a target user interface, determining the user interface at the position of the current external circulation times in the first sequence as the target user interface, and entering the target user interface through url of the target user interface; secondly, determining a target window, determining a window located at the position of the current internal circulation times in a second sequence corresponding to the target user interface as the target window, and entering the target window through the url address of the target window; after entering the target window, the position of the field in the target window needs to be determined through the relative path of the field contained in the target window.
If the position of a field in the target window is determined, a preset field value can be assigned to the field, a request for inquiring the table name of the table to which the field in the target window belongs is obtained, and further a log file corresponding to the request can be obtained; the log file comprises sql statements corresponding to fields in a target window, and the sql statements corresponding to the fields comprise table names of tables to which the fields belong; the table names of the tables to which the fields belong can be obtained from the sql statement contained in the log file, so that the table names of the tables to which all the fields in the current target window belong can be obtained. And returning to the step of determining that the window positioned at the position of the current internal circulation times in the second sequence corresponding to the target user interface is the target window until the target window is the last position in the second sequence corresponding to the target user interface, so that the table names of the tables to which all fields in all windows contained in the current target user interface belong can be obtained. And returning to the step of determining that the user interface at the position of the current outer loop times in the first sequence is the target user interface until the target user interface is the last position in the first sequence, so that the table names of the tables to which all fields in all windows contained in all target user interfaces belong can be obtained. Therefore, if the table name of the table to which the field belongs is required to be inquired, automatic inquiry operation can be realized, manual inquiry operation is not required, and time and labor are effectively saved.
It can be understood that, after table names of tables to which fields in all sql statements belong are screened out by using matching rules, the table names of the tables to which all the fields belong can be stored in a specified file, and in order to make the corresponding relationship between the fields and the table names of the tables to which the fields belong more clearly and more directly displayed, the file can be finally converted into an excel file.
And step B11, storing the table names of the tables to which the fields belong into a file.
And B12, converting the file into a file with a dataframe format, wherein the file with the dataframe format comprises a corresponding relation between fields and table names of the tables to which the fields belong, a plurality of the fields form a column, the table names of the tables to which the fields belong form a column, and the column in which the fields belong is an index column.
Where dataframe is a tabular type data structure containing an ordered set of columns, each column may be a different value type. The file storing the table names of the tables to which the fields belong is a text type file, the text type file cannot be directly converted into an excel type file, and the text type file can be converted into the excel type file containing correct content only by manually arranging the content contained in the text file in a corresponding relation; therefore, the file containing the table names of the tables to which the fields belong can be converted into the file with the dataframe format, and the content contained in the text file can be automatically arranged in the form of corresponding relation by the file with the dataframe format, so that the labor and the time are effectively saved.
For example, when searching the table name of the table to which the field a belongs, the index column needs to be searched first to find the position of the field a in the index column, and then the table name corresponding to the field a can be found from the table name of the table to which the field belongs. If the index is not established for the column where the field is located, when the table name of the table where the field belongs is searched, whether the field matched with the field A exists in all columns in the table or not is searched, and therefore the search time is long. If the index is established for the column of the field, namely, the column of the fields is set as the index column, when the table name of the table to which the field belongs is searched, the fields are only searched to form a column, so that the index is established, the data searching time can be effectively shortened, and the table name of the table to which the fields belong can be quickly searched during the searching.
And step B13, obtaining an excel file through the file with the dataframe format, wherein the excel file comprises the corresponding relation between fields and the table names of the tables to which the fields belong, and a plurality of the fields form a column and a plurality of the table names of the tables to which the fields belong form a column.
Exemplarily, as shown in fig. 3, it is assumed that the table names of the tables to which the queried field "case type", field "case number" and field "case state" respectively belong are "case table", "client table" and "case table", and the excel file shown in table 1 can be finally obtained through conversion of the file format.
TABLE 1
Field(s) Table name
Case type Example table
Case number Customer meter
Case status Example table
For example, table 1 is only an example, and the content and the form of the content of the excel file are not limited herein.
It can be understood that the matching rule may determine that the name after the special character in the sql statement is the table of the table to which the field belongs, but there is a case that no name exists behind the special character, at this time, the matching rule cannot determine the table name of the table to which the field belongs, and a matching error may occur.
In an optional implementation manner, the table name of the table to which each field belongs may be displayed on a corresponding window included in the user interface, for example, the table name of the table to which the field belongs may be directly displayed above or on a side of the field, so that after the table name of the table to which the field belongs is queried, the query result may be more conveniently and directly presented to the user for the user to view.
For example, as shown in fig. 3, the current target user interface is "information query", the target window on the target user interface is "query", the target window has seven fields, which are respectively a field "case type", a field "case number", a field "case state", a field "customer number", a field "case description", a field "customer name", and a field "customer type", and if the table name of the table to which the field "case type" belongs is finally queried is "case table"; the table name of the table to which the "case number" belongs is "case table"; the table name of the table to which the "case state" belongs is "case table"; the table name of the table to which the "customer number" belongs is "customer table"; the table name of the table to which the case description belongs is a case table; the table name of the table to which the "customer name" belongs is a "customer table"; the table name of the table to which the "client type" belongs is "client table". The table name of the table to which the field belongs may be displayed directly on the right side of the field as shown in fig. 5.
The method is described in detail in the embodiments disclosed in the present application, and the method of the present application can be implemented by using various types of apparatuses, so that the present application also discloses an apparatus, and the following detailed description is given for specific embodiments.
Referring to fig. 6, fig. 6 is a block diagram of a table name query apparatus according to an exemplary embodiment, the apparatus including: a first obtaining unit 41, a first determining unit 42, a first entering unit 43, a second determining unit 44, a second entering unit 45, a third determining unit 46, an assigning unit 47, a second obtaining unit 48, a third obtaining unit 49, an obtaining unit 50, a first returning unit 51 and a second returning unit 52, wherein:
a first obtaining unit 41, configured to obtain a configuration file, where the configuration file includes uniform resource locators url corresponding to a plurality of user interfaces, a first order, a url of a window included in each user interface, a second order corresponding to each user interface, a relative path where each field is located in the window, and a preset field value corresponding to each field, where the first order refers to a plurality of user interface orderings, and the second order corresponding to the user interfaces is a window ordering included in the user interfaces;
a first determining unit 42, configured to determine that the user interface located at the position of the current outer loop times in the first order is the target user interface;
a first entering unit 43, configured to enter the target user interface through a url of the target user interface;
a second determining unit 44, configured to determine, as a target window, a window located at a position of the current inner loop times in a second sequence corresponding to the target user interface;
a second entering unit 45, configured to enter the target window through the url address of the target window;
a third determining unit 46, configured to determine, through a relative path of the field included in the target window, a position of the field located in the target window;
an assigning unit 47, configured to assign the preset field value to the field in the target window;
a second obtaining unit 48, configured to obtain a request for querying a table name of a table to which the field in the target window belongs;
a third obtaining unit 49, configured to obtain a log file corresponding to the request, where the log file includes a structured query language sql statement corresponding to the field in the target window, and the sql statement corresponding to the field includes a table name of a table to which the field belongs;
an obtaining unit 50, configured to obtain, from the sql statement included in the log file, a table name of a table to which the field belongs;
a first returning unit 51, configured to return to the second determining unit 44 until the target window is the last in the second order corresponding to the target user interface;
a second returning unit 52, configured to return to the first determining unit 42 until the target user interface is the last bit in the first order.
In an optional implementation manner, in the apparatus for table name query, the obtaining unit includes:
the system comprises an acquisition module, a matching module and a display module, wherein the acquisition module is used for acquiring a preset matching rule, the matching rule contains special characters, and the name behind the special characters in the matching rule is a table name;
and the determining module is used for determining that the name behind the special character in the sql statement is the table name of the table to which the field belongs if the sql statement conforms to the matching rule.
In an optional implementation manner, the apparatus for table name query further includes:
the first storing module is used for storing the table names of the tables to which the fields belong into a file;
the conversion module is used for converting the file into a file in a dataframe format, wherein the file in the dataframe format comprises a corresponding relation between fields and table names of tables to which the fields belong, a plurality of the fields form a column, the table names of the tables to which the fields belong form a column, and the column in which the fields belong is an index column;
an obtaining module, configured to obtain an excel file from the dataframe-formatted file, where the excel file includes a correspondence between fields and table names of tables to which the fields belong, and a plurality of the fields form a column and a plurality of the table names of the tables to which the fields belong form a column.
In an optional implementation manner, the apparatus for table name query further includes:
and the second storage module is used for storing the sql statement as the table name of the field into the file if the name behind the special character in the sql statement does not exist.
In an optional implementation manner, the apparatus for table name query further includes:
and the display module is used for displaying the table name of the table to which the field belongs on the user interface.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 7 is a block diagram illustrating an apparatus for an electronic device in accordance with an example embodiment.
Electronic devices include, but are not limited to: a processor 61, a memory 62, a network interface 63, an I/O controller 64, and a communication bus 65.
It should be noted that, as those skilled in the art will appreciate, the structure of the electronic device shown in fig. 7 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown in fig. 7, or may combine some components, or may have different component arrangements.
The following describes each component of the electronic device in detail with reference to fig. 7:
the processor 61 is a control center of the electronic device, connects various parts of the entire electronic device by various interfaces and lines, performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 62 and calling data stored in the memory 62, thereby performing overall monitoring of the electronic device. Processor 61 may include one or more processing units; illustratively, the processor 61 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 61.
Processor 61 may be a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement embodiments of the present invention, or the like;
the Memory 62 may include a Memory, such as a Random-Access Memory (RAM) 621 and a Read-Only Memory (ROM) 622, and may also include a mass storage device 623, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The memory 62 is configured to store the executable instructions of the processor 61. The processor 61 has the following functions: and (5) table name query.
A wired or wireless network interface 63 is configured to connect the electronic device to a network.
The processor 61, the memory 62, the network interface 63, and the I/O controller 64 may be connected to each other by a communication bus 65, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc.
In an exemplary embodiment, the electronic device may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above table name lookup method.
In an exemplary embodiment, the disclosed embodiments provide a storage medium comprising instructions, such as a memory 62 comprising instructions, executable by a processor 61 of an electronic device to perform the above-described method. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It should be noted that the table name query method, apparatus, electronic device and readable storage medium provided by the present invention may be used in the financial field or other fields, for example, may be used in a table name query application scenario in the financial field. The other fields are arbitrary fields other than the financial field, for example, the internet field. The foregoing is merely an example, and does not limit the application fields of the table name query method, apparatus, electronic device, and readable storage medium provided in the present invention.
It should be noted that the features described in the embodiments in the present specification may be replaced with or combined with each other. For the device or system type embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A table name query method is characterized by comprising the following steps:
the method comprises the steps of obtaining a configuration file, wherein the configuration file comprises uniform resource locators url corresponding to a plurality of user interfaces respectively, a first sequence, the url of a window contained in each user interface, a second sequence corresponding to each user interface, a relative path of each field located in the window and a preset field value corresponding to each field, the first sequence refers to the sequencing of the user interfaces, and the second sequence corresponding to the user interfaces is the sequencing of the windows contained in the user interfaces;
determining a user interface at a position of the current outer loop times in the first sequence as a target user interface;
entering the target user interface through the url of the target user interface;
determining a window located at the position of the current internal circulation times in a second sequence corresponding to the target user interface as a target window;
entering the target window through the url address of the target window;
determining the position of the field in the target window through the relative path of the field contained in the target window;
assigning the preset field value to the field in the target window;
obtaining a request for querying a table name of a table to which the field belongs in the target window;
obtaining a log file corresponding to the request, wherein the log file comprises a structured query language (sql) statement corresponding to the field in the target window, and the sql statement corresponding to the field comprises a table name of a table to which the field belongs;
obtaining the table name of the table to which the field belongs from the sql statement contained in the log file;
returning to the step of determining that the window located at the position of the current internal circulation times in the second sequence corresponding to the target user interface is the target window until the target window is the last position in the second sequence corresponding to the target user interface;
and returning to the step of determining that the user interface at the position of the current outer circulation times in the first sequence is the target user interface until the target user interface is the last position in the first sequence.
2. The method according to claim 1, wherein the step of obtaining the table name of the table to which the field belongs from the sql statement contained in the log file comprises:
acquiring a preset matching rule, wherein the matching rule contains a special character, and the name behind the special character in the matching rule is a table name;
and if the sql statement conforms to the matching rule, determining that the name behind the special character in the sql statement is the table name of the table to which the field belongs.
3. The method of claim 1 or 2, further comprising:
storing the table names of the tables to which the fields belong into a file;
converting the file into a file with a dataframe format, wherein the file with the dataframe format comprises a corresponding relation between fields and table names of tables to which the fields belong, a plurality of the fields form a column, the table names of the tables to which the fields belong form a column, and the column in which the fields belong is an index column;
obtaining an excel file through the dataframe format file, wherein the excel file comprises corresponding relations between fields and table names of tables to which the fields belong, and a plurality of the fields form a column and a plurality of the table names of the tables to which the fields belong form a column.
4. The method of claim 3, further comprising:
and if the name behind the special character in the sql statement does not exist, storing the sql statement as the table name to which the field belongs into the file.
5. The method of claim 1, 2 or 4, further comprising:
and displaying the table name of the table to which the field belongs on the user interface.
6. A table name lookup apparatus, comprising:
a first obtaining unit, configured to obtain a configuration file, where the configuration file includes url (uniform resource locator) information, a first order, url of a window included in each user interface, a second order corresponding to each user interface, a relative path of each field in the window, and a preset field value corresponding to each field, where the first order refers to a plurality of user interface orderings, and the second order corresponding to the user interfaces is a window ordering included in the user interfaces;
a first determining unit, configured to determine that a user interface located at a position of a current outer loop frequency in the first order is a target user interface;
the first entering unit is used for entering the target user interface through the url of the target user interface;
a second determining unit, configured to determine that a window located at a position of the current inner loop times in a second sequence corresponding to the target user interface is a target window;
the second entering unit is used for entering the target window through the url address of the target window;
a third determining unit, configured to determine, through a relative path of the field included in the target window, a position of the field located in the target window;
an assignment unit, configured to assign the preset field value to the field in the target window;
a second obtaining unit, configured to obtain a request for querying a table name of a table to which the field belongs in the target window;
a third obtaining unit, configured to obtain a log file corresponding to the request, where the log file includes a structured query language sql statement corresponding to the field in the target window, and the sql statement corresponding to the field includes a table name of a table to which the field belongs;
an obtaining unit, configured to obtain, from the sql statement included in the log file, a table name of a table to which the field belongs;
the first returning unit is used for returning to the second determining unit until the target window is the last in the second sequence corresponding to the target user interface;
and the second returning unit is used for returning to the first determining unit until the target user interface is the last bit in the first sequence.
7. The apparatus of claim 6, wherein the obtaining unit comprises:
the system comprises an acquisition module, a matching module and a display module, wherein the acquisition module is used for acquiring a preset matching rule, the matching rule contains special characters, and the name behind the special characters in the matching rule is a table name;
and the determining module is used for determining that the name behind the special character in the sql statement is the table name of the table to which the field belongs if the sql statement conforms to the matching rule.
8. The apparatus of claim 6 or 7, further comprising:
the first storing module is used for storing the table names of the tables to which the fields belong into a file;
the conversion module is used for converting the file into a file in a dataframe format, wherein the file in the dataframe format comprises a corresponding relation between fields and table names of tables to which the fields belong, a plurality of the fields form a column, the table names of the tables to which the fields belong form a column, and the column in which the fields belong is an index column;
an obtaining module, configured to obtain an excel file from the dataframe-formatted file, where the excel file includes a correspondence between fields and table names of tables to which the fields belong, and a plurality of the fields form a column and a plurality of the table names of the tables to which the fields belong form a column.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the table name querying method according to any one of claims 1 to 5.
10. A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the table name lookup method according to any one of claims 1 to 5.
CN202211325487.1A 2022-10-27 2022-10-27 Table name query method and device, electronic equipment and readable storage medium Pending CN115712637A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211325487.1A CN115712637A (en) 2022-10-27 2022-10-27 Table name query method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211325487.1A CN115712637A (en) 2022-10-27 2022-10-27 Table name query method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115712637A true CN115712637A (en) 2023-02-24

Family

ID=85231837

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211325487.1A Pending CN115712637A (en) 2022-10-27 2022-10-27 Table name query method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115712637A (en)

Similar Documents

Publication Publication Date Title
CN109086394B (en) Search ranking method and device, computer equipment and storage medium
CN111339171B (en) Data query method, device and equipment
CN106156088B (en) Index data processing method, data query method and device
CN110928739B (en) Process monitoring method and device and computing equipment
CN113220657B (en) Data processing method and device and computer equipment
CN112182014A (en) Database query method, device, equipment and storage medium
CN111047434B (en) Operation record generation method and device, computer equipment and storage medium
CN109885729B (en) Method, device and system for displaying data
CN116611411A (en) Business system report generation method, device, equipment and storage medium
CN109086414B (en) Method, apparatus and storage medium for searching blockchain data
CN111435406A (en) Method and device for correcting database statement spelling errors
CN109117448B (en) Thermodynamic diagram generation method and device
CN110874365B (en) Information query method and related equipment thereof
CN110515979B (en) Data query method, device, equipment and storage medium
CN113761565A (en) Data desensitization method and apparatus
CN109189810B (en) Query method, query device, electronic equipment and computer-readable storage medium
CN115712637A (en) Table name query method and device, electronic equipment and readable storage medium
CN108197253B (en) Equipment query method, device and equipment of cloud monitoring platform
CN114048136A (en) Test type determination method, device, server, medium and product
EP4053713A1 (en) Question and answer method and apparatus based on knowledge graph
CN114356991A (en) Data query method, data aggregation method, device, equipment and medium
CN113486283A (en) Page merging method, device, server, medium and product
CN110674386B (en) Resource recommendation method, device and storage medium
CN113094624A (en) Page generation method and device and electronic equipment
CN111078671A (en) Method, device, equipment and medium for modifying data table field

Legal Events

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