CN115840767A - Data query method, device, equipment and storage medium - Google Patents

Data query method, device, equipment and storage medium Download PDF

Info

Publication number
CN115840767A
CN115840767A CN202211494149.0A CN202211494149A CN115840767A CN 115840767 A CN115840767 A CN 115840767A CN 202211494149 A CN202211494149 A CN 202211494149A CN 115840767 A CN115840767 A CN 115840767A
Authority
CN
China
Prior art keywords
service
data table
field
fields
service data
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
CN202211494149.0A
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.)
Wuhan Weineng Battery Assets Co ltd
Original Assignee
Wuhan Weineng Battery Assets 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 Wuhan Weineng Battery Assets Co ltd filed Critical Wuhan Weineng Battery Assets Co ltd
Priority to CN202211494149.0A priority Critical patent/CN115840767A/en
Publication of CN115840767A publication Critical patent/CN115840767A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data query method, a data query device, equipment and a storage medium, wherein the method comprises the following steps: receiving a service data table query request, and determining whether a plurality of service data tables include a target service data table according to the identifiers of a plurality of query service fields, wherein each service data table comprises: the target business field is the business field which is acquired from the preset storage middleware and corresponds to the data table content type of each business data table, and if the plurality of business data tables comprise the target business data table, the target business data table is output. Therefore, a plurality of service data tables can be generated according to the service fields and the field values synchronized from the database in the preset storage middleware, and the target service data table is determined from the plurality of service data tables according to the query service fields, so that the association on the data flow is realized instead of the association on the database, the stability of the database is ensured, and the query performance is improved.

Description

Data query method, device, equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data query method, apparatus, device, and storage medium.
Background
With the development of business, data is expanded continuously, and when business data analysis is performed, data among a plurality of data tables is often required to be correlated, so that business personnel can analyze and make decisions conveniently, and various reports of a company can be output quickly conveniently.
In the prior art, data association query is usually performed by depending on a database, and in order to ensure service stability, a database and a table of an Oracle database are usually required to be divided, and a large table is required to be stored in different servers and to be physically isolated, that is, a table a exists on three servers S1, S2 and S3, and the sum of data of the three servers is the sum of the table.
However, the database is stressed by the database for performing data association query, and for storing data in sub-databases and sub-tables, the data needs to be associated for many times, so that the data processing difficulty and complexity become high, and a large performance bottleneck is brought.
Disclosure of Invention
In view of this, embodiments of the present application provide a data query method, apparatus, device and storage medium, so as to solve the problems that a database is subjected to a great pressure when a database is subjected to data association query, and data processing difficulty and complexity are great when data is stored in sub-databases and sub-tables.
In a first aspect, an embodiment of the present application provides a data query method, including:
receiving a service data table query request, wherein the service data table query request comprises: identification of a plurality of query service fields;
determining whether a plurality of service data tables include a target service data table or not according to the identifiers of the plurality of query service fields, wherein each service data table comprises: a target service field and a field value of the target service field, where the target service field is a service field corresponding to a data table content type of each service data table acquired from a preset storage middleware, and the preset storage middleware includes: a plurality of service fields synchronized from a database and field values of the plurality of service fields;
and if the plurality of service data tables comprise a target service data table, outputting the target service data table.
In an optional embodiment, the method further comprises:
if the target business data table is not included in the plurality of business data tables, field values of the plurality of inquiry business fields are obtained from the preset storage middleware;
and generating the target service data table according to the plurality of inquiry service fields and the field values of the plurality of inquiry service fields.
In an optional implementation manner, before determining whether the target service data table is included in the plurality of service data tables according to the identifiers of the plurality of query service fields, the method further includes:
synchronizing the plurality of service fields in the database and the field values of the plurality of service fields to the preset storage middleware;
according to a plurality of preset data table content types, determining a target service field matched with each data table content type and a field value of the target service field from the plurality of service fields in the preset storage middleware;
and generating a service data table corresponding to the content type of each data table according to the target service field and the field value of the target service field.
In an optional embodiment, the method further comprises:
determining at least two candidate service data tables meeting preset conditions from the plurality of service data tables;
aggregating the at least two candidate service data tables to generate an aggregated service data table, wherein the aggregated service data table comprises: target service fields of the at least two candidate service data tables and field values of the target service fields;
and adding the aggregated service data table to the plurality of service data tables.
In an optional embodiment, the synchronizing the plurality of service fields in the database and the field values of the plurality of service fields to the preset storage middleware includes:
sequentially passing through a first storage middleware and a temporary storage database, and synchronizing the plurality of service fields in the database and the field values of the plurality of service fields into a second storage middleware;
the determining, according to a plurality of preset data table content types, a target service field matched with each data table content type and a field value of the target service field from the plurality of service fields in the preset storage middleware includes:
and according to a plurality of preset data table content types, determining the target service field matched with each data table content type and the field value of the target service field from the plurality of service fields in the second storage middleware.
In an optional embodiment, before outputting the target service data table, the method further includes:
before the storage time of the temporary storage database is reached, carrying out data verification on the target service data table according to the field values of the plurality of inquiry service fields in the temporary storage database;
the outputting the target service data table includes:
and if the verification is passed, outputting the target service data table.
In an optional embodiment, the method further comprises:
if the adjustment operation for the field value of any service field in the database is detected, writing the adjusted field value into a partition corresponding to the any service field in the preset storage middleware, wherein the partition comprises: at least one field value of the arbitrary traffic field;
and reading the adjusted field value from the partition corresponding to the any service field, and updating the field value of the any service field in the corresponding service data table according to the adjusted field value.
In a second aspect, an embodiment of the present application further provides a data query apparatus, including:
a receiving module, configured to receive a service data table query request, where the service data table query request includes: identification of a plurality of query service fields;
a determining module, configured to determine whether a target service data table is included in the plurality of service data tables according to the identifiers of the plurality of query service fields, where each service data table includes: a target service field and a field value of the target service field, where the target service field is a service field corresponding to a data table content type of each service data table acquired from a preset storage middleware, and the preset storage middleware includes: a plurality of service fields synchronized from a database and field values of the plurality of service fields;
and the output module is used for outputting the target service data table if the plurality of service data tables comprise the target service data table.
In an optional embodiment, the apparatus further comprises:
an obtaining module, configured to obtain field values of the query service fields from the preset storage middleware if the target service data table is not included in the service data tables;
and the processing module is used for generating the target service data table according to the plurality of inquiry service fields and the field values of the plurality of inquiry service fields.
In an optional implementation manner, the processing module is further configured to:
synchronizing the plurality of service fields in the database and the field values of the plurality of service fields to the preset storage middleware;
the determining module is further configured to determine, according to a plurality of preset data table content types, a target service field matched with each data table content type and a field value of the target service field from the plurality of service fields in the preset storage middleware;
the processing module is further configured to generate a service data table corresponding to the content type of each data table according to the target service field and the field value of the target service field.
In an optional embodiment, the determining module is further configured to:
determining at least two candidate service data tables meeting preset conditions from the plurality of service data tables;
the processing module is further configured to aggregate the at least two candidate service data tables to generate an aggregated service data table, where the aggregated service data table includes: target service fields of the at least two candidate service data tables and field values of the target service fields;
the processing module is further configured to add the aggregated service data table to the plurality of service data tables.
In an optional implementation manner, the processing module is specifically configured to:
sequentially passing through a first storage middleware and a temporary storage database, and synchronizing the plurality of service fields in the database and the field values of the plurality of service fields into a second storage middleware;
the determining module is specifically configured to:
and according to a plurality of preset data table content types, determining the target service field matched with each data table content type and the field value of the target service field from the plurality of service fields in the second storage middleware.
In an optional implementation manner, the processing module is further configured to:
before the storage time of the temporary storage database is reached, carrying out data verification on the target service data table according to the field values of the plurality of inquiry service fields in the temporary storage database;
the output module is specifically configured to:
and if the verification is passed, outputting the target service data table.
In an optional implementation manner, the processing module is further configured to:
if the adjustment operation for the field value of any service field in the database is detected, writing the adjusted field value into a partition corresponding to the any service field in the preset storage middleware, wherein the partition comprises: at least one field value of the arbitrary traffic field;
and reading the adjusted field value from the partition corresponding to the any service field, and updating the field value of the any service field in the corresponding service data table according to the adjusted field value.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, when the electronic device runs, the processor and the memory communicate through the bus, and the processor executes the machine-readable instructions to execute the data query method of any one of the first aspect.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the data query method according to any one of the first aspects.
The embodiment of the application provides a data query method, a data query device, data query equipment and a storage medium, wherein the method comprises the following steps: receiving a service data table query request, wherein the service data table query request comprises: and determining whether the plurality of service data tables comprise a target service data table or not according to the identifiers of the plurality of inquiry service fields, wherein each service data table comprises: the method comprises a target service field and field values of the target service field, wherein the target service field is a service field which is acquired from preset storage middleware and corresponds to the data table content type of each service data table, and the preset storage middleware comprises the following steps: if the plurality of service data tables comprise a target service data table, outputting the target service data table. Therefore, a plurality of service data tables can be generated according to the service fields and the field values synchronized from the database in the preset storage middleware, and the target service data table is determined from the plurality of service data tables according to the query service fields, so that the association on the data flow is realized instead of the association on the database, the stability of the database is ensured, and the query performance is improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a first schematic flowchart of a data query method according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating a second data query method according to an embodiment of the present application;
fig. 3 is a schematic flowchart illustrating a data query method according to an embodiment of the present application;
fig. 4 is a fourth schematic flowchart of a data query method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a data query system according to an embodiment of the present application;
fig. 6 is a schematic flowchart of a data query method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a data query device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
For example, when a database is used for performing data association query in the prior art, all data in the database needs to be traversed, and great pressure is applied to the database, for example, a table a has a data volume of 1 million a day, a table B has a data volume of 100 million a day, the data volumes of a table a day are associated, the association result volume is 50 million, all data in the table a needs to be taken out, and then corresponding association relation data is filtered out.
And aiming at the problems that the data needs to traverse three databases in the database sub-table storage, the data is associated for many times, and the data processing difficulty and the complexity are high, the application provides a data query method, a plurality of business data tables are generated according to business fields and field values synchronized from the databases in a preset storage middleware, a target business data table is determined from the business data tables according to the query business fields, the data is associated based on data flow and then stored into the business data table, the association is saved in a database layer, the operation is saved, the query performance is improved, the data service pressure is not brought while the business is steadily increased, the database stability is ensured, and the data processing difficulty and the complexity are reduced.
The data query method provided by the present application is described below with reference to several specific embodiments.
Fig. 1 is a schematic flow chart of a data query method according to an embodiment of the present application, where an execution subject of the embodiment may be an electronic device.
As shown in fig. 1, the method may include:
s101, receiving a service data table query request.
In an actual application scenario, if the service data table needs to be queried, a service data table query request may be sent to the electronic device, where the service data table query request includes: the identifiers of the plurality of query service fields, where the query service fields may be service fields in a service data table to be queried, for example: grade one, chinese achievement, mathematics achievement.
The electronic device can be provided with a visual query interface, a user can input a plurality of query service fields through the visual query interface, and the sending of the query request of the service data table is realized by selecting a query control on the visual query interface, and correspondingly, the electronic device receives the query request of the service data table.
S102, determining whether the plurality of business data tables comprise the target business data table or not according to the identifications of the plurality of inquiry business fields.
Determining whether a plurality of service data tables include a target service data table or not according to the identifiers of the plurality of query service fields, wherein each service data table comprises: the method comprises the following steps that a target service field and field values of the target service field, namely the target service field of a target service data table comprises a plurality of inquiry service fields, wherein the target service field is a service field which is acquired from preset storage middleware and corresponds to the content type of the data table of each service data table, and the preset storage middleware comprises: a plurality of service fields synchronized from a database and field values of the plurality of service fields.
The preset storage middleware may be, for example, kafka, which is a common message middleware and is a distributed streaming media platform, similar to a message queue or an enterprise message delivery system.
That is, a plurality of business fields in the database and field values of the plurality of business fields are synchronized to the preset storage middleware, when a plurality of business data tables are generated, a target business field and a field value of the target business field are determined from the preset storage middleware according to the data table content type of each business data table, and a corresponding business data table is generated based on the target business field and the field value of the target business field, wherein the data table content type includes but is not limited to a score data table type and a personal information data table type, for the business data table of the score data table type, the target business field may include a student name, a Chinese score, a math score, an English score and the like, and for the business data table of the personal information data table type, the target business field may include a student name, a teacher name, a class name, an age, a parent telephone and the like.
It should be noted that the database may be any type of database, such as an Oracle database, and the database may be a database-partitioned table storage database, where the database includes a service field and a field value of the service field, so that it is not necessary to traverse three databases to associate data to generate a service data table, and the service data in the database is synchronized to a preset storage middleware, and the association on a data stream is realized based on the preset storage middleware instead of the association on the database, thereby reducing the difficulty and complexity of data processing. And moreover, the data are synchronized into the preset storage middleware, so that the data are decoupled, the downstream service can conveniently use the data from the preset storage middleware, the performance and the stability of the service database can be ensured, and performance fluctuation caused by synchronization can be avoided.
And S103, if the plurality of service data tables comprise the target service data table, outputting the target service data table.
And if the plurality of service data tables generated in advance comprise the target service data table, outputting the target service data table as a query result.
In the data query method of this embodiment, by receiving a service data table query request, and according to the identifiers of a plurality of query service fields, it is determined whether a plurality of service data tables include a target service data table, where each service data table includes: the target business field is the business field which is acquired from the preset storage middleware and corresponds to the data table content type of each business data table, and if the plurality of business data tables comprise the target business data table, the target business data table is output. Therefore, a plurality of service data tables can be generated according to the service fields and the field values synchronized from the database in the preset storage middleware, and the target service data table is determined from the plurality of service data tables according to the query service fields, so that the association on the data flow is realized instead of the association on the database, the stability of the database is ensured, and the query performance is improved.
In an optional embodiment, the method may further include:
if the plurality of business data tables do not comprise the target business data table, field values of a plurality of inquiry business fields are obtained from a preset storage middleware; and generating a target service data table according to the plurality of inquiry service fields and the field values of the plurality of inquiry service fields.
If the pre-generated service data tables do not include the target service data table, field values of a plurality of query service fields are obtained from the preset storage middleware, and the target service data table is generated according to the query service fields and the field values of the query service fields, wherein the query service fields can be service fields in the same data table in the database or service fields of different data tables in the database, are synchronized to the preset storage middleware through the service fields in the database, and association on data streams is realized through the preset storage middleware to generate the target service data table, so that the data processing difficulty and complexity are reduced.
Fig. 2 is a second flowchart of the data query method provided in the embodiment of the present application, and as shown in fig. 2, before determining whether a target service data table is included in a plurality of service data tables according to the identifiers of a plurality of query service fields, the method may further include:
s201, synchronizing a plurality of service fields in the database and field values of the plurality of service fields to a preset storage middleware.
The database may include a plurality of data tables, the data tables include a plurality of service fields and field values of the plurality of service fields, and the plurality of service fields and the field values of the plurality of service fields in the database are synchronized to the preset storage middleware, that is, the preset storage middleware includes: a plurality of service fields synchronized from a database and field values of the plurality of service fields.
For example, the database may be an Oracle database, after the service field and the field value of the service field are written into the Oracle database, the Oracle database may start data synchronization, and synchronize the service field and the field value of the service field in Oracle to Kafka middleware by using an ogg synchronization tool, where ogg may synchronize only the field value of the changed field, for example, if the field value of k1 in fields k1, k2, and k3 is changed, only the field value of k1 is synchronized to Kafka, it is understood that, at the first synchronization, since all the service fields and field values in the database are changed fields, at the first synchronization, the full-volume service field and field value are synchronized.
S202, according to a plurality of preset data table content types, determining a target service field matched with each data table content type and a field value of the target service field from a plurality of service fields in a preset storage middleware.
The data table content type is used to indicate the type of content contained in the data table, and may include, for example, a performance data table type and a personal information data table type.
According to the preset content types of a plurality of data tables, a target business field matched with the content type of each data table and the field value of the target business field can be determined from a plurality of business fields in the preset storage middleware, wherein the target business field matched with the content type of each data table can be a business field included in the business data table of the content type of the data table, such as a business data table of a score data table type, and the target business field can include the name of a student, a Chinese score, a math score, an English score and the like; personal information spreadsheet type business datasheet, target business fields may include student name, teacher name, class name, age, parent phone, etc.
Of course, the above is only an example, and in practical applications, there may be a mapping relationship between the target service fields matching the data table content types, and the target service fields corresponding to the data table content types may be determined through the mapping relationship.
S203, generating a business data table corresponding to the content type of each data table according to the target business field and the field value of the target business field.
Generating a service data table corresponding to the content type of each data table according to the target service field corresponding to the content type of each data table and the field value of the target service field, where the service field in the service data table may include: a target traffic field.
Fig. 3 is a schematic flowchart of a third process of the data query method provided in the embodiment of the present application, as shown in fig. 3, the method may further include:
s301, determining at least two candidate service data tables meeting preset conditions from the plurality of service data tables.
The preset conditions may include, for example, the types of the contents of the same data table, that is, at least two candidate business data tables belonging to the same data table content type are determined from the multiple business data tables according to the data table content types, for example, if the score a table of zhang and the score B table of lie are both of the score data table types, the a table and the B table are used as at least two candidate business data tables, the business fields in the a table and the B table respectively include the name and the score of a student, the field value of the name of the student in the a table is zhang, the field value of the score is 80, the field value of the name of the student in the B table is lie four, and the field value of the score is 90.
The preset condition may further include, for example, that the service fields in the service data table belong to subclasses under a preset aggregation granularity, where the preset aggregation granularity is a grade, the subclasses of the grade may include names of all students in the grade, and then at least two candidate service data tables meeting the preset condition may be language score tables of all students in the grade, the service fields in each candidate service data table respectively include corresponding names of students, such as zhang, lii, and the like, one candidate service data table corresponds to a score table of a grade student, and the service fields in one candidate service data table may include names of students and scores.
S302, aggregating the at least two candidate service data tables to generate an aggregated service data table.
The service fields in the at least two candidate service data tables are target service fields, and the field values of the service fields are the field values of the target service fields.
Aggregating at least two candidate service data tables may be understood as summarizing the target service fields and the field values of the target service fields of the at least two candidate service data tables to generate an aggregated service data table, where the aggregated service data table includes: a target service field of at least two candidate service data tables and a field value of the target service field.
For example, the score a table of zhang three and the score B table of lie four all belong to score data table types, the table a and the table B are aggregated to generate an aggregated business data table of zhang three and lie four, business fields in the aggregated business data table include student names and scores, and field values of the student names include: zhang three and Li four, the field value of the score includes 80, 90.
For another example, the score tables of all students in a grade are aggregated to generate an aggregated business data table of all students in a grade, the business fields in the aggregated business data table include names and scores of the students, the field values of the names of the students are the names of all students in a grade, and the field values of the scores are the score values of all students in a grade.
And S303, adding the aggregated service data table into a plurality of service data tables.
And generating an aggregated service data table on the basis of the plurality of service data tables, and adding the aggregated service data table into the plurality of service data tables, so that high-granularity aggregation can be realized, service personnel can be provided for analysis and decision during subsequent query, and various reports can be conveniently and rapidly output.
It should be noted that, the generated multiple service data tables may be stored in the dw layer of the doris database, and fall to the ads layer of the doris database in a high granularity aggregation manner to form a service report, and an output platform (such as a BI report platform) is docked to form an analysis report.
Fig. 4 is a fourth schematic flowchart of a data query method provided in an embodiment of the present application, and as shown in fig. 4, synchronizing field values of a plurality of service fields and a plurality of service fields in a database to a preset storage middleware includes:
s401, sequentially passing through the first storage middleware and the temporary storage database, and synchronizing the plurality of service fields in the database and the field values of the plurality of service fields into the second storage middleware.
The field values of the plurality of service fields and the plurality of service fields in the database can be synchronized in the first storage middleware and synchronized in the temporary storage database by the first storage middleware, the temporary storage database is used for temporarily storing data, and then the data in the temporary storage database is synchronized in the second storage middleware.
The preset storage middleware comprises a first storage middleware and a second storage middleware, the first storage middleware and the second storage middleware can be Kafka, the Kafka is a common message middleware, is a distributed streaming media platform, is similar to a message queue or an enterprise message delivery system, and can be a temporary storage database, such as a mysql database, and can temporarily store data for 3 days.
Fig. 5 is a schematic diagram of a data query system according to an embodiment of the present application, as shown in fig. 5, three databases of a service field and a field value of the service field in an Oracle database are saved, service data is written into the Oracle database, data synchronization is started, an ogg synchronization tool is used to synchronize the service field and the field value of the service field in the Oracle into a first Kafka middleware, the first Kafka middleware is connected to a mysql database, data in the first Kafka middleware is landed into the mysql database, a binlog synchronization tool of the mysql is used to start full-field synchronization, the field values of fields k1, k2, and k3, namely { k1: v1, k2: v2, k3: v3} are all synchronized into a second Kafka middleware, a flink engine is used to consume the service field and the field value in the second Kafka to generate a service data table, and the service data table is stored in a doris database.
It can be understood that, when updating the field value of the service field, in order to ensure that the latest field value can be read, when synchronizing the field and the field value to the second Kaka middleware, the field value of the same field can be synchronized to the same partition, and the data sequence is ensured.
Correspondingly, according to a plurality of preset data table content types, determining a target service field matched with each data table content type from a plurality of service fields in the preset storage middleware, including:
s402, according to the preset content types of the plurality of data tables, determining a target service field matched with the content type of each data table and a field value of the target service field from the plurality of service fields in the second storage middleware.
The method comprises the steps that a plurality of service fields of a database and field values of the plurality of service fields are synchronized to a second storage middleware, the plurality of service fields in the second storage middleware can be consumed according to preset content types of the plurality of data tables, a target service field matched with the content type of each data table and the field value of the target service field are determined from the plurality of service fields in the second storage middleware, and each service data table is generated based on the field values of the target service field and the target service field.
In an optional implementation manner, before outputting the target service data table, the method may further include:
and before the storage time of the temporary storage database is reached, carrying out data verification on the target service data table according to the field values of a plurality of inquiry service fields in the temporary storage database.
After the target service data table matched with the data table query request is determined, before the storage time of the temporary storage database is reached, data verification can be performed on the target service data table according to the field values of the plurality of query service fields in the temporary storage database, wherein the temporary storage database is used for temporarily storing the plurality of service fields synchronized from the database and the field values of the plurality of service fields, that is, in order to ensure the correctness of the generated target service data table, data verification is performed on the field values of the plurality of query service fields in the temporary storage database, and if the verification is passed, the target service data table is output, so that the correctness of the output target service data table is ensured.
Fig. 6 is a schematic flowchart of a fifth flow chart of the data query method provided in the embodiment of the present application, as shown in fig. 6, the method may further include:
s501, if the adjustment operation of the field value of any service field in the database is detected, writing the adjusted field value into a partition corresponding to any service field in the preset storage middleware.
If the adjustment operation for the field value of any service field in the database is detected, writing the adjusted field value of any service field for which the adjustment operation is directed into a partition (topic) corresponding to any service field in the preset storage middleware, wherein the partition comprises: at least one field value of an arbitrary service field for which a plurality of field values of the arbitrary service field are included in the partition if the field value of the arbitrary service field is adjusted a plurality of times, wherein a last field value is a latest field value of the arbitrary service field.
The preset storage middleware comprises a plurality of partitions, one partition corresponds to one service field, data in one partition can be divided into three types of data for addition, deletion and modification, namely, the adjustment operation comprises an updating operation and a deleting operation, the updating operation comprises an adding operation and a deleting operation, and for the deleting operation, the adjusted field value can be null and has a deleting identifier.
It is worth mentioning that the concept of partitions being kafka, where sending to the same partition ensures the sequentiality of consuming kafka data, because kafka only ensures single partition orderliness, if two adjustments of one piece of data are stored in two different partitions of kafka, respectively, a sequence disorder may occur when downstream services are used, for example, first adjustment is 1, then adjustment is 2, but actually first adjustment is 2, then adjustment is 1.
S502, reading the adjusted field value from the partition corresponding to any service field, and updating the field value of any service field in the corresponding service data table according to the adjusted field value.
And reading the adjusted field value from the partition corresponding to the arbitrary service field, and updating the field value of the arbitrary service field in the corresponding service data table according to the adjusted field value, wherein the service field in the corresponding service data table may include the arbitrary service field, and the field value of the arbitrary service field in the corresponding service data table is updated to the adjusted field value, that is, the landing data in the service data table is modified based on the updated data, or the landing data in the service data table is modified based on the deleted data.
Based on the same inventive concept, a data query device corresponding to the data query method is also provided in the embodiments of the present application, and because the principle of solving the problem of the device in the embodiments of the present application is similar to the data query method in the embodiments of the present application, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Fig. 7 is a schematic structural diagram of a data query apparatus according to an embodiment of the present application, where the apparatus may be integrated in an electronic device. As shown in fig. 7, the apparatus may include:
a receiving module 601, configured to receive a service data table query request, where the service data table query request includes: identification of a plurality of query service fields;
a determining module 602, configured to determine, according to the identifiers of the multiple query service fields, whether a target service data table is included in the multiple service data tables, where each service data table includes: the method comprises a target service field and field values of the target service field, wherein the target service field is a service field which is acquired from preset storage middleware and corresponds to the data table content type of each service data table, and the preset storage middleware comprises the following steps: a plurality of service fields synchronized from a database and field values of the plurality of service fields;
an output module 603, configured to output the target service data table if the plurality of service data tables include the target service data table.
In an optional embodiment, the apparatus further comprises:
an obtaining module 604, configured to obtain field values of a plurality of query service fields from a preset storage middleware if the plurality of service data tables do not include the target service data table;
the processing module 605 is configured to generate a target service data table according to the plurality of query service fields and the field values of the plurality of query service fields.
In an optional implementation, the processing module 605 is further configured to:
synchronizing a plurality of service fields in a database and field values of the service fields to a preset storage middleware;
the determining module 602 is further configured to determine, according to the preset content types of multiple data tables, a target service field matched with the content type of each data table and a field value of the target service field from multiple service fields in the preset storage middleware;
the processing module 605 is further configured to generate a service data table corresponding to the content type of each data table according to the target service field and the field value of the target service field.
In an optional embodiment, the determining module 602 is further configured to:
determining at least two candidate service data tables meeting preset conditions from the plurality of service data tables;
the processing module 605 is further configured to aggregate the at least two candidate service data tables to generate an aggregated service data table, where the aggregated service data table includes: target service fields of at least two candidate service data tables and field values of the target service fields;
the processing module 605 is further configured to add the aggregated service data table to a plurality of service data tables.
In an optional implementation, the processing module 605 is specifically configured to:
sequentially passing through a first storage middleware and a temporary storage database, and synchronizing a plurality of service fields in the database and field values of the plurality of service fields into a second storage middleware;
the determining module 602 is specifically configured to:
and according to a plurality of preset data table content types, determining a target service field matched with each data table content type and a field value of the target service field from a plurality of service fields in the second storage middleware.
In an optional implementation, the processing module 605 is further configured to:
before the storage time of the temporary storage database is reached, carrying out data verification on a target service data table according to field values of a plurality of query service fields in the temporary storage database;
the output module 603 is specifically configured to:
and if the verification is passed, outputting the target service data table.
In an optional implementation, the processing module 605 is further configured to:
if the adjustment operation for the field value of any service field in the database is detected, writing the adjusted field value into a partition corresponding to any service field in the preset storage middleware, wherein the partition comprises: at least one field value of any service field;
and reading the adjusted field value from the partition corresponding to any service field, and updating the field value of any service field in the corresponding service data table according to the adjusted field value.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 8, the electronic device may include: a processor 701, a memory 702 and a bus 703, wherein the memory 702 stores machine-readable instructions executable by the processor 701, when the electronic device runs, the processor 701 communicates with the memory 702 through the bus 703, and the processor 701 executes the machine-readable instructions to execute the data query method.
The embodiment of the application also provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the processor executes the data query method.
In the embodiments of the present application, when being executed by a processor, the computer program may further execute other machine-readable instructions to perform other methods as described in the embodiments, and for the method steps and principles of specific execution, reference is made to the description of the embodiments, and details are not repeated here.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the units into only one type of logical function may be implemented in other ways, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus once an item is defined in one figure, it need not be further defined and explained in subsequent figures, and moreover, the terms "first", "second", "third", etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the present disclosure, which should be construed in light of the above teachings. Are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for querying data, comprising:
receiving a service data table query request, wherein the service data table query request comprises: identification of a plurality of query service fields;
determining whether a plurality of service data tables include a target service data table or not according to the identifiers of the plurality of query service fields, wherein each service data table comprises: a target service field and a field value of the target service field, where the target service field is a service field corresponding to a data table content type of each service data table acquired from a preset storage middleware, and the preset storage middleware includes: a plurality of service fields synchronized from a database and field values of the plurality of service fields;
and if the plurality of service data tables comprise a target service data table, outputting the target service data table.
2. The method of claim 1, further comprising:
if the target business data table is not included in the plurality of business data tables, field values of the plurality of inquiry business fields are obtained from the preset storage middleware;
and generating the target service data table according to the plurality of inquiry service fields and the field values of the plurality of inquiry service fields.
3. The method of claim 1, wherein before determining whether the target service data table is included in the plurality of service data tables according to the identity of the plurality of query service fields, the method further comprises:
synchronizing the plurality of service fields in the database and the field values of the plurality of service fields to the preset storage middleware;
according to a plurality of preset data table content types, determining a target service field matched with each data table content type and a field value of the target service field from the plurality of service fields in the preset storage middleware;
and generating a service data table corresponding to the content type of each data table according to the target service field and the field value of the target service field.
4. The method of claim 1 or 3, further comprising:
determining at least two candidate service data tables meeting preset conditions from the plurality of service data tables;
aggregating the at least two candidate service data tables to generate an aggregated service data table, wherein the aggregated service data table comprises: target service fields of the at least two candidate service data tables and field values of the target service fields;
and adding the aggregated service data table to the plurality of service data tables.
5. The method of claim 3, wherein synchronizing the plurality of business fields in the database and the field values of the plurality of business fields to the pre-set storage middleware comprises:
sequentially passing through a first storage middleware and a temporary storage database, and synchronizing the plurality of service fields in the database and the field values of the plurality of service fields into a second storage middleware;
the determining, according to a plurality of preset data table content types, a target service field matched with each data table content type and a field value of the target service field from the plurality of service fields in the preset storage middleware includes:
and according to a plurality of preset data table content types, determining the target service field matched with each data table content type and the field value of the target service field from the plurality of service fields in the second storage middleware.
6. The method of claim 5, wherein before outputting the target service data table, the method further comprises:
before the storage time of the temporary storage database is reached, carrying out data verification on the target service data table according to the field values of the plurality of inquiry service fields in the temporary storage database;
the outputting the target service data table includes:
and if the verification is passed, outputting the target service data table.
7. The method of claim 1, further comprising:
if the adjustment operation for the field value of any service field in the database is detected, writing the adjusted field value into a partition corresponding to the any service field in the preset storage middleware, wherein the partition comprises: at least one field value of the arbitrary traffic field;
and reading the adjusted field value from the partition corresponding to the any service field, and updating the field value of the any service field in the corresponding service data table according to the adjusted field value.
8. A data query apparatus, comprising:
a receiving module, configured to receive a service data table query request, where the service data table query request includes: identification of a plurality of query service fields;
a determining module, configured to determine whether a target service data table is included in the plurality of service data tables according to the identifiers of the plurality of query service fields, where each service data table includes: a target service field and a field value of the target service field, where the target service field is a service field corresponding to a data table content type of each service data table acquired from a preset storage middleware, and the preset storage middleware includes: a plurality of service fields synchronized from a database and field values of the plurality of service fields;
and the output module is used for outputting the target service data table if the plurality of service data tables comprise the target service data table.
9. An electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, the processor and the memory communicate with each other through the bus when the electronic device is operated, and the processor executes the machine-readable instructions to execute the data query method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs a data query method as claimed in any one of claims 1 to 7.
CN202211494149.0A 2022-11-25 2022-11-25 Data query method, device, equipment and storage medium Pending CN115840767A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211494149.0A CN115840767A (en) 2022-11-25 2022-11-25 Data query method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211494149.0A CN115840767A (en) 2022-11-25 2022-11-25 Data query method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115840767A true CN115840767A (en) 2023-03-24

Family

ID=85577297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211494149.0A Pending CN115840767A (en) 2022-11-25 2022-11-25 Data query method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115840767A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116910825A (en) * 2023-09-12 2023-10-20 上海融和元储能源有限公司 Data synchronization method and device based on kafka

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116910825A (en) * 2023-09-12 2023-10-20 上海融和元储能源有限公司 Data synchronization method and device based on kafka
CN116910825B (en) * 2023-09-12 2023-12-15 上海融和元储能源有限公司 Data synchronization method and device based on kafka

Similar Documents

Publication Publication Date Title
US10445321B2 (en) Multi-tenant distribution of graph database caches
US9798831B2 (en) Processing data in a MapReduce framework
US10671671B2 (en) Supporting tuples in log-based representations of graph databases
US20120072464A1 (en) Systems and methods for master data management using record and field based rules
CN104933173B (en) It is a kind of for the data processing method of isomery multi-data source, device and server
US20220083618A1 (en) Method And System For Scalable Search Using MicroService And Cloud Based Search With Records Indexes
US20200279004A1 (en) Building lineages of documents
WO2019017997A1 (en) Distributed graph database writes
CN112416991A (en) Data processing method and device and storage medium
US10445370B2 (en) Compound indexes for graph databases
CN115840767A (en) Data query method, device, equipment and storage medium
CN113297238A (en) Method and device for information mining based on historical change records
US11727330B2 (en) Systems and methods for efficiently distributing alert messages
US20180357328A1 (en) Functional equivalence of tuples and edges in graph databases
CN111143421A (en) Data sharing method and device, electronic equipment and storage medium
CN111881110B (en) Data migration method and device
US20180039708A1 (en) Multi-reference event summarization
CN116701355A (en) Data view processing method, device, computer equipment and readable storage medium
WO2016010591A1 (en) Search engine using name clustering
US20180357297A1 (en) Rdb system
US11934437B2 (en) Stance detection and summarization for data sources
CN113934729A (en) Data management method based on knowledge graph, related equipment and medium
CN104166739B (en) The index document handling method and device of analytical database
CN111368178A (en) Information processing method and device and readable storage medium
CN112783980A (en) Data synchronization processing method and device, electronic equipment and computer readable medium

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