CN110019350B - Data query method and device based on configuration information - Google Patents

Data query method and device based on configuration information Download PDF

Info

Publication number
CN110019350B
CN110019350B CN201710631092.7A CN201710631092A CN110019350B CN 110019350 B CN110019350 B CN 110019350B CN 201710631092 A CN201710631092 A CN 201710631092A CN 110019350 B CN110019350 B CN 110019350B
Authority
CN
China
Prior art keywords
query
cache
key
configuration information
index
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.)
Active
Application number
CN201710631092.7A
Other languages
Chinese (zh)
Other versions
CN110019350A (en
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710631092.7A priority Critical patent/CN110019350B/en
Publication of CN110019350A publication Critical patent/CN110019350A/en
Application granted granted Critical
Publication of CN110019350B publication Critical patent/CN110019350B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Abstract

The invention discloses a data query method and device based on configuration information, and relates to the technical field of computers. One embodiment of the method comprises: receiving a query request of an application system based on a unified service framework; the query request includes: inquiring parameters and index identification ID which uniquely points to a target database corresponding to the application system; acquiring configuration information according to the index ID; the configuration information includes: inquiring a statement template; dynamically generating an executable query statement according to the query parameter and the query statement template; and obtaining a query result according to the executable query statement. The embodiment can provide a uniform query mode for multiple systems, effectively reduce the number of code compiling, improve the readability of executable query sentences, and greatly improve the data query efficiency and the development and production efficiency. In addition, the embodiment simultaneously supports high availability, high concurrency and flexible expansion, and can adapt to more service scenes and fields.

Description

Data query method and device based on configuration information
Technical Field
The invention relates to the technical field of computers, in particular to a data query method and device based on configuration information.
Background
In the prior art, when data query is carried out, query statements are often written directly in codes. The data query method has at least the following problems:
1) different systems often correspond to different databases, and the data structures of different databases are not necessarily the same. Therefore, when data query is carried out on different systems, query sentences need to be written in codes respectively, the repeatability is high, the code writing amount is large, the management and maintenance of the query sentences are difficult, and the difficulty and the period of project development are greatly increased;
2) the readability of the code of the query sentence is low, and a large amount of time is needed for understanding and positioning the query sentence;
3) when the query statement is modified or optimized each time, the system needs to be brought online again, and the efficiency of data query is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data query method and apparatus based on configuration information, which can provide a unified query mode for multiple systems, effectively reduce the number of code writes, improve the readability of executable query statements, and greatly improve the efficiency of data query and the efficiency of development and production. In addition, the embodiment simultaneously supports high availability, high concurrency and flexible expansion, and can adapt to more service scenes and fields.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a data query method based on configuration information, including:
receiving a query request of an application system based on a unified service framework; the query request includes: inquiring parameters and index identification ID which uniquely points to a database corresponding to the application system;
acquiring configuration information according to the index ID; the configuration information includes: inquiring a statement template;
dynamically generating an executable query statement according to the query parameter and the query statement template;
and acquiring a query result according to the executable query statement.
Optionally, the service framework is implemented by remote procedure call protocol RPC or WebService or hypertext transfer protocol HTTP.
Optionally, a query statement template is generated based on the type, and/or dimensions, and/or index ID of the query request.
Optionally, positioning the query statement template according to the index ID;
and replacing the parameter placeholders of the query statement template with the query parameters to dynamically generate the executable query statement.
Optionally, the data query method further includes: the query request and the corresponding query result are used as cache records and stored in a cache module;
obtaining the query result according to the executable query statement includes:
judging whether a cache record corresponding to the query request exists in the cache module; and if so, acquiring a query result corresponding to the query request from the cache record.
Optionally, the configuration information further includes: a first cache cycle;
for each cache record in the cache module: and if the caching time of the cache record is longer than the first caching period, deleting the cache record.
Optionally, the cache record is generated as follows:
generating a unique identifier according to the index ID and the query parameter;
and taking the corresponding relation between the identifier and the query result as a cache record.
Optionally, the cache module adopts a key-value pair database; the cache record is generated by the following method:
splicing the index ID and the query parameter into a character string, and generating a key value name key with uniqueness based on the spliced character string;
taking a query result corresponding to the query request as a key value;
and taking the corresponding relation between the key and the value as a cache record.
Optionally, obtaining the query result according to the executable query statement includes:
splicing the index ID and the query parameters of the current query request into a character string, and calculating the character string by adopting a Hash algorithm or an information summary algorithm to generate a key to be queried;
judging whether a key to be inquired exists in the cache module; and if so, acquiring a value corresponding to the key to be queried from the cache record, and taking the value as a query result.
Optionally, obtaining the query result according to the executable query statement includes:
and accessing a target database corresponding to the application system by adopting the connection buffer pool, executing the executable query statement from the target database, and acquiring a query result.
Optionally, the target database corresponding to the application system is a non-relational database, and the configuration information further includes: the cluster's internet protocol IP group and index name; alternatively, the first and second electrodes may be,
the target database is a relational database, and the configuration information further includes: the network domain name or IP of the target database, and the library name.
According to still another aspect of the embodiments of the present invention, there is provided a data query apparatus based on configuration information, including:
the communication module adopts a unified service framework;
a service module to: receiving a query request of an application system based on a service framework, wherein the query request comprises: inquiring parameters and index identification ID which uniquely points to a database corresponding to the application system; acquiring configuration information according to the index ID; the configuration information includes: inquiring a statement template; dynamically generating an executable query statement according to the query request and the query statement template; and obtaining a query result according to the executable query statement.
Optionally, the service framework of the communication module is implemented by a remote procedure call protocol RPC or WebService or hypertext transfer protocol HTTP.
Optionally, the service module generates a query statement template based on the type, and/or dimension, and/or index ID of the query request; alternatively, the first and second electrodes may be,
the apparatus of this embodiment further comprises: and the parameter configuration module is used for generating a query statement template based on the type and/or dimension of the query request and the index ID.
Optionally, the service module locates the query statement template according to the index ID;
the service module replaces the parameter placeholder of the query statement template with the query parameter, and dynamically generates an executable query statement.
Optionally, the data query apparatus further comprises: a cache module;
the service module takes the query request and the corresponding query result as cache records and stores the cache records to the cache module;
the service module is further to: judging whether a cache record corresponding to the query request exists in the cache module; and if so, acquiring a query result corresponding to the query request from the cache record.
Optionally, the configuration information further includes: a first cache cycle;
the service module is further to:
for each cache record in the cache module: and if the caching time of the caching record is longer than the first caching period, deleting the caching record.
Optionally, the service module generates the cache record according to the following method:
generating a unique identifier according to the index ID and the query parameter;
and taking the corresponding relation between the identifier and the query result as a cache record.
Optionally, the cache module adopts a key-value pair database;
the service module generates a cache record according to the following method:
splicing the index ID and the query parameter into a character string, and generating a key value name key with uniqueness based on the spliced character string;
taking a query result corresponding to the query request as a key value;
and storing the corresponding relation between the key and the value as a cache record in a key-value pair database.
Optionally, the service module is further configured to:
splicing the index ID and the query parameters of the current query request into a character string, and calculating the character string by adopting a Hash algorithm or an information summary algorithm to generate a key to be queried;
judging whether a key to be inquired exists in the cache module; and if so, acquiring a value corresponding to the key to be queried from the cache record, and taking the value as a query result.
Optionally, the communication module further comprises: connecting a buffer pool;
the service module is further to: and accessing a target database corresponding to the application system by adopting the connection buffer pool, executing the executable query statement from the target database, and acquiring a query result.
Optionally, the target database corresponding to the application system is a non-relational database, and the configuration information further includes: the cluster's internet protocol IP group and index name; alternatively, the first and second electrodes may be,
the target database is a relational database, and the configuration information further includes: the network domain name or IP of the target database, and the library name.
According to another aspect of the embodiments of the present invention, a terminal for providing data query based on configuration information includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the configuration information based data query method of the present invention.
According to still another aspect of embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program, when executed by a processor, implementing the configuration information based data query method of the present invention.
One embodiment of the above invention has the following advantages or benefits: by adopting a uniform service framework, acquiring configuration information comprising the query statement template according to the index ID and dynamically generating the executable query statement according to the query parameters and the query statement template, the technical problem that the query statement must be written in the code when a query request is made every time is overcome, and the technical effects of reducing the number of written codes, improving the readability of the executable query statement, greatly improving the data query efficiency and developing the production efficiency are achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a data query method based on configuration information according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main steps of a data query method based on configuration information according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an architecture of a data query device based on configuration information according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of a data query device based on configuration information according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use with a terminal or server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a data query method based on configuration information according to an embodiment of the present invention, as shown in fig. 1, including:
s101, receiving a query request of an application system based on a uniform service framework; the query request includes: inquiring parameters and index identification ID which uniquely points to a database corresponding to the application system;
step S102, obtaining configuration information according to the index ID; the configuration information includes: inquiring a statement template;
step S103, dynamically generating an executable query statement according to the query parameter and the query statement template;
and step S104, acquiring a query result according to the executable query statement.
The invention manages the executable query sentence uniformly based on the uniform service frame, and does not need to know the underlying network when performing data query each time, thereby being applicable to various service scenes and fields, and greatly improving the efficiency of data query and the development and production efficiency. The invention can provide a uniform query mode for multiple systems, each application system can call a uniform service interface to send parameter information such as index ID, query parameters and the like to obtain corresponding query results, and query sentences do not need to be written in codes respectively when query requests are carried out each time, so that the number of code writing can be greatly reduced, the readability of executable query sentences can be improved, the management and maintenance difficulty of the query sentences can be reduced, and the efficiency of data query can be improved. Because the executable query statement in the embodiment is generated according to the query statement template and the query parameter, rather than being generated based on writing in the code in the prior art, the executable query statement can take effect without making the system online again when being modified or optimized each time, and the efficiency of data query is high. The data query method and the data query device support high availability, high concurrency and flexible expansion, and can adapt to more service scenes and fields.
In some embodiments, the Service Framework is implemented by a Remote Procedure Call Protocol (RPC), such as a Jingdong Service Framework (JSF) Framework, a DUBBO Framework, and the like. RPC is a protocol that requests services from a remote computer program over a network without knowledge of underlying network technology, enabling cross-platform, cross-language data transfer.
The service framework may also be implemented via HyperText Transfer Protocol (HTTP). The HTTP protocol is a transfer protocol for transferring hypertext from a WWW server to a local browser, and in some embodiments, based on the HTTP protocol, a POST may be used to submit data to a specified resource for processing requests, e.g., submitting a form or uploading a file, or a GET may be used to issue a request to a specific resource, e.g., sending a request to a server for obtaining data, etc. The service framework based on the HTTP protocol can make the browser more efficient and reduce network transmission.
Of course, those skilled in the art can implement the service framework of the present invention in other manners, such as via WebService. The Web Service can realize the mutual data exchange or integration of different application systems running on different machines without additional and special third-party software or hardware. Therefore, the application systems implemented according to the Web Service specification can exchange data with each other regardless of whether the languages, platforms, or internal protocols used by the respective application systems are the same or not.
Compared with the prior art that a large number of query sentences need to be written and maintained respectively, the query sentence template is adopted to generate the executable query sentences, and only the query sentence template needs to be maintained, so that the writing amount and the maintenance amount of the executable query sentences are greatly reduced. To minimize the number of query statement templates maintained, various query requests from various application systems may share a single query statement template. In the actual use process, the query statement template can also be generated based on the type and/or dimension of the query request and/or the index ID so as to improve the efficiency of each query. For example, the query request may be divided into different service types, such as available inventory query, expired commodity query, to-be-rechecked order query, and the like, and a query statement template is respectively set for each type; or respectively setting a plurality of categories of the query request according to the data dimension information contained in the query request, and respectively setting a query statement template for each category; in addition, the query requests may be grouped according to the storage location of the target database corresponding to the index ID, and each group shares one query statement template.
The storage position of the configuration information can be set according to actual conditions, for example, the configuration information is stored in a target database corresponding to the application system, and the configuration information is obtained from the target database according to the index ID; the configuration information can also be stored on the file server, and the configuration information is obtained from the file server according to the index ID; of course, the configuration information may also be stored inside the application system or on other elements having a storage function. When a plurality of query statement templates are employed, the plurality of query statement templates may be stored on different storage media, respectively.
The target database may be a relational database, such as Structured Query Language (MYSQL), or a non-relational database. The configuration information may further include: and the data information uniquely points to the target database corresponding to the application system. For example, when the target database corresponding to the application system is a non-relational database, the configuration information may further include: the cluster's internet protocol IP group and index name. When the target database is a relational database, the configuration information may further include: the network domain name or IP of the target database, and the library name. Through the data information, a target database corresponding to the application system can be quickly positioned, and the executable query statement is executed from the target database to obtain a query result.
In some optional embodiments, the query statement template is positioned according to the index ID to determine the storage location of the query statement template; and replacing the parameter placeholders of the query statement template with the query parameters to dynamically generate the executable query statement. Compared with the prior art that query statements need to be written in codes respectively for each query request, the method and the device can greatly simplify the writing amount of the executable query statements and reduce the management and maintenance difficulty of the executable query statements.
The generation mode and composition of the index ID are not particularly limited, as long as the index ID can uniquely point to a target database corresponding to the application system. The technical personnel in the art can use the unique identifier of the application system and/or the target database corresponding to the application system as the index ID of the application system, and can also generate the index ID based on the unique identifier of the application system and/or the target database corresponding to the application system and by adopting a preset index rule.
The data format of the query result can be set according to actual needs. In some embodiments, to facilitate the application system to parse the query result, the data format of the query result is: JSON, and/or XML, and/or TXT.
In some optional embodiments, the query request and the corresponding query result are stored to the cache module as a cache record; obtaining the query result according to the executable query statement includes: judging whether a cache record corresponding to the query request exists in the cache module; and if so, acquiring a query result corresponding to the query request from the cache record. Further preferably, if no cache record corresponding to the query request exists in the cache module, the executable query statement is executed, a query result is obtained, and the query request and the corresponding query result are stored in the cache module as cache records.
By caching the query result, the data query efficiency can be improved, the system load can be greatly reduced, and the operating pressure in the data query process is reduced. Preferably, the configuration information further comprises: a first cache cycle; for each cache record in the cache module: and if the caching time of the cache record is longer than the first caching period, deleting the cache record. Therefore, the load of the query request access can be further reduced, and the query request access efficiency is improved.
In some optional embodiments, the cache record is generated as follows: generating a unique identifier according to the index ID and the query parameter; and taking the corresponding relation between the identifier and the query result as a cache record. An identifier can be uniquely determined according to the index ID and the query parameter of the query request; for a plurality of query requests, if the index IDs corresponding to the query requests are the same and the query parameters are the same, the identifiers of the query requests are the same as the query results and correspond to the same cache record. And determining the corresponding relation between the executable query statement and the cache record by adopting the identifier, so that the cache record corresponding to the query request can be conveniently and quickly searched in the cache module.
Taking the cache module adopting the key-value pair database as an example, the cache record can be generated by the following method: splicing the index ID and the query parameter into a character string, and generating a key value name key with uniqueness based on the spliced character string; taking a query result corresponding to the query request as a key value; and taking the corresponding relation between the key and the value as a cache record. For example, a hash algorithm or a message digest algorithm may be used to calculate the character string, and generate a unique key. A key can be uniquely determined according to a character string spliced by the index ID and the query parameter of the query request; for a plurality of query requests, if the index IDs corresponding to the plurality of query requests are the same and the query parameters are the same, the keys and the values of the plurality of query requests are the same and correspond to the same cache record.
In some embodiments, obtaining query results from the executable query statement comprises:
splicing the index ID and the query parameters of the current query request into a character string, and calculating the character string by adopting a Hash algorithm or an information summary algorithm to generate a key to be queried;
judging whether a key to be inquired exists in the cache module; and if so, acquiring a value corresponding to the key to be queried from the cache record, and taking the value as a query result.
In some optional embodiments, obtaining the query result from the executable query statement comprises: and accessing a target database corresponding to the application system by adopting the connection buffer pool, executing the executable query statement from the target database, and acquiring a query result. A number of connections to the target database may be reserved in the connection buffer pool for use in executing the executable query statement. When accessing a target database, firstly judging whether idle connection exists in a connection buffer pool; if so, accessing the target database by using the idle connection; and if the connection does not exist, creating a new connection, then accessing the target database by using the new connection, executing the executable query statement from the target database, and acquiring a query result. The connection buffer pool can be used repeatedly, so that system resources are saved greatly, the system operation pressure is reduced, and the data query efficiency is improved.
Preferably, the configuration information further comprises: a second cache cycle; and for each connection in the connection buffer pool, if the caching time of the connection is longer than the second caching period, destroying the connection. Therefore, the use efficiency of the connection buffer pool can be improved.
Fig. 2 is a schematic diagram of main steps of a data query method according to an embodiment of the present invention, including:
receiving a query request of an application system based on a uniform service framework, positioning a query statement template by adopting an index ID, and dynamically generating an executable query statement according to the query request and the query statement template;
splicing the index ID and the query parameter of the application system into a character string, and calculating the character string by adopting a Hash algorithm to generate a key to be queried;
judging whether the key to be inquired exists in the cache module:
if yes, obtaining a value corresponding to the key to be queried, taking the value as a query result, and returning the query result to the application system;
if not, executing the executable query statement to obtain a query result; judging whether the query is successful: if the query result is successful, taking the query result as a value, storing the key to be queried and the value as cache records to a cache module, and returning the query result to the application system; if not, returning error information.
As shown in fig. 4, there is provided a data query apparatus 400 based on configuration information, including:
the communication module 401, the communication module 401 adopts a unified service framework;
a service module 402 for: receiving a query request of an application system based on a service framework, wherein the query request comprises: inquiring parameters and index identification ID which uniquely points to a database corresponding to the application system; acquiring configuration information according to the index ID; the configuration information includes: inquiring a statement template; dynamically generating an executable query statement according to the query request and the query statement template; and obtaining a query result according to the executable query statement.
Fig. 3 is a schematic structural diagram of a data query apparatus based on configuration information according to an embodiment of the present invention, and as shown in fig. 3, the data query apparatus 400 may receive query requests of multiple application systems, such as application system 1, application system 2, application system 3, and application system … …, where N is a positive integer; and analyzing the query request to obtain a query result, and returning the query result to the application system. The invention manages the executable query statement in a unified way based on a unified service framework, and does not need to know the underlying network every time data query is carried out, so that the invention is suitable for various scenes and systems and realizes cross-platform and cross-language data query. Compared with the prior art that each application system writes query statements in codes respectively when carrying out query requests each time, the method and the system can share one query statement template, and can obtain corresponding query results only by receiving parameter information such as index IDs, query parameters and the like sent by the application systems, thereby greatly reducing the number of code writing, reducing the management and maintenance difficulty of executable query statements, and improving the efficiency of data query.
Optionally, the service framework of the communication module 401 is implemented by remote procedure call protocol RPC or WebService.
Optionally, the service module generates a query statement template based on the type and/or dimension of the query parameter and the index ID; alternatively, the first and second electrodes may be,
the data query apparatus 400 of the present embodiment further includes: a parameter configuration module 404, configured to generate a query statement template based on the type, and/or dimension, and/or index ID of the query request.
Alternatively,
the service module 402 locates the query statement template from the target database according to the utilization index ID;
the service module 402 replaces the parameter placeholders of the query statement template with the query parameters and dynamically generates the executable query statement.
Optionally, the data query apparatus 400 based on configuration information of the present embodiment further includes: a cache module 403;
the service module 402 stores the query request and the corresponding query result as a cache record to the cache module;
the service module 402 is further configured to: judging whether a cache record corresponding to the query request exists in the cache module; and if so, acquiring a query result corresponding to the query request from the cache record.
Optionally, the configuration information further includes: a first cache cycle;
the service module 402 is further configured to:
for each cache record in the cache module 402: and if the caching time of the caching record is longer than the first caching period, deleting the caching record.
Optionally, the service module 402 generates the cache record according to the following method:
generating a unique identifier according to the index ID and the query parameter;
and taking the corresponding relation between the identifier and the query result as a cache record.
Optionally, the caching module 403 employs a key-value pair database;
the service module 402 generates the cache record as follows:
splicing the index ID and the query parameter into a character string, and generating a key value name key with uniqueness based on the spliced character string;
taking a query result corresponding to the query request as a key value;
and storing the corresponding relation between the key and the value as a cache record in a key-value pair database.
Optionally, the service module 402 is further configured to:
splicing the index ID and the query parameters of the current query request into a character string, and calculating the character string by adopting a Hash algorithm or an information summary algorithm to generate a key to be queried;
judging whether a key to be inquired exists in the cache module 403; and if so, acquiring a value corresponding to the key to be queried from the cache record, and taking the value as a query result.
Optionally, the communication module 401 further comprises: connecting a buffer pool;
the service module 402 accesses the target database corresponding to the application system by using the connection buffer pool, executes the executable query statement from the target database, and obtains a query result.
Optionally, the configuration information further includes: a second cache cycle;
the service module is further to:
for each connection cached in the connection buffer pool: if the cache time of the connection is longer than the second cache period, the connection is destroyed.
Optionally, the target database corresponding to the application system is a non-relational database, and the configuration information further includes: the cluster's internet protocol IP group and index name; alternatively, the first and second electrodes may be,
the target database is a relational database, and the configuration information further includes: the network domain name or IP of the target database, and the library name.
According to another aspect of the embodiments of the present invention, there is provided a terminal for querying data based on configuration information, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the configuration information based data query method of the present invention.
Fig. 5 illustrates an exemplary system architecture 500 of a data query method based on configuration information or a data query device based on configuration information to which an embodiment of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have various communication client applications installed thereon, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server can analyze and process the received data such as the product information inquiry request and feed back the processing result to the terminal equipment.
It should be noted that the data query method based on configuration information provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the data query apparatus based on configuration information is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal implementing an embodiment of the invention is shown. The terminal shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not form a limitation on the modules themselves in some cases, and for example, the sending module may also be described as a "module sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to implement the configuration information based data query method of the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (22)

1. A data query method based on configuration information is characterized by comprising the following steps:
receiving a query request of an application system based on a unified service framework; the query request includes: inquiring parameters and index identification ID uniquely pointing to a target database corresponding to the application system;
splicing the index ID and the query parameter into a character string, generating a unique key value name key based on the spliced character string, and judging whether the key value name key exists in a cache module; the cache module adopts a key value pair database;
if so, obtaining a value corresponding to the key value name key, taking the value as a query result and returning the query result to the application system;
if the index ID does not exist, acquiring configuration information according to the index ID; the configuration information includes: inquiring a statement template; dynamically generating an executable query statement according to the query parameter and the query statement template; and obtaining a query result according to the executable query statement, returning the query result to the application system, if the query result is not empty, taking the query result as value, and storing the key value name key and the value as cache records to the cache module.
2. The data query method of claim 1, wherein the service framework is implemented by a remote procedure call protocol (RPC) or WebService or Hypertext transfer protocol (HTTP).
3. The data query method of claim 2, wherein a query statement template is generated based on a type, and/or a dimension, and/or an index ID of the query request.
4. The data query method of claim 2,
positioning a query statement template according to the index ID;
and replacing the parameter placeholder of the query statement template with the query parameter to dynamically generate an executable query statement.
5. The data query method of claim 2, wherein the cache record further comprises a correspondence between the query request and the query result;
the obtaining a query result according to the executable query statement comprises:
judging whether a cache record corresponding to the query request exists in the cache module; and if so, acquiring a query result corresponding to the query request from the cache record.
6. The data query method of claim 5, wherein the configuration information further comprises: a first cache cycle;
for each cache record in the cache module: and if the caching time of the caching record is longer than a first caching period, deleting the caching record.
7. The data query method of claim 1, wherein the generating a key-value key with uniqueness based on the spliced character string and determining whether the key-value key exists in a cache module comprises:
and calculating the character string by adopting a Hash algorithm or an information abstract algorithm to generate a key to be inquired, and judging whether the key to be inquired exists in the cache module.
8. The data query method of any one of claims 1-7, wherein the string is a unique identifier.
9. The data query method of claim 1, wherein said obtaining query results from the executable query statement comprises:
and accessing a target database corresponding to the application system by adopting a connection pool, executing the executable query statement from the target database, and acquiring a query result.
10. The data query method of claim 1, wherein the target database is a non-relational database, and the configuration information further comprises: the cluster's internet protocol IP group and index name; alternatively, the first and second electrodes may be,
the target database is a relational database, and the configuration information further includes: the network domain name or IP of the target database, and the library name.
11. A data query device based on configuration information, comprising:
the communication module adopts a unified service framework;
the service module is used for receiving a query request of an application system based on the service framework; the query request includes: inquiring parameters and index identification ID uniquely pointing to a target database corresponding to the application system; splicing the index ID and the query parameter into a character string, generating a unique key value name key based on the spliced character string, and judging whether the key value name key exists in a cache module; the cache module adopts a key value pair database; if so, obtaining a value corresponding to the key value name key, taking the value as a query result and returning the query result to the application system;
if the index ID does not exist, acquiring configuration information according to the index ID; the configuration information includes: inquiring a statement template; dynamically generating an executable query statement according to the query parameter and the query statement template; and obtaining a query result according to the executable query statement, returning the query result to the application system, if the query result is not empty, taking the query result as value, and storing the key value name key and the value as cache records to the cache module.
12. The data querying device of claim 11, wherein the service framework of the communication module is implemented by a remote procedure call protocol (RPC) or WebService or Hypertext transfer protocol (HTTP).
13. The data query apparatus of claim 12, wherein the service module generates the query statement template based on a type and/or dimension of the query request and the index ID; alternatively, the first and second electrodes may be,
the data query device further comprises: and the parameter configuration module is used for generating the query statement template based on the type and/or the dimension and/or the index ID of the query request.
14. The data query device of claim 12, wherein the service module locates a query statement template according to the index ID;
and the service module replaces the query parameter placeholder of the query statement template with the query parameter to dynamically generate an executable query statement.
15. The apparatus of claim 12, wherein the service module stores the query request and the corresponding query result as a cache record to a cache module;
the service module is further to: judging whether a cache record corresponding to the query request exists in the cache module; and if so, acquiring a query result corresponding to the query request from the cache record.
16. The data query apparatus of claim 15, wherein the configuration information further comprises: a first cache cycle;
the service module is further to:
for each cache record in the cache module: and if the caching time of the caching record is longer than a first caching period, deleting the caching record.
17. The data query apparatus of claim 11, wherein the service module is further configured to:
and calculating the character string by adopting a Hash algorithm or an information abstract algorithm to generate a key to be inquired, and judging whether the key to be inquired exists in the cache module.
18. The data query device of any one of claims 11-17, wherein the string is a unique identifier.
19. The apparatus of claim 11, wherein the communication module further comprises: connecting a buffer pool;
and the service module accesses a target database corresponding to the application system by adopting a connection buffer pool, executes the executable query statement from the target database and acquires a query result.
20. The data query apparatus of claim 11,
the target database is a non-relational database, and the configuration information further includes: the cluster's internet protocol IP group and index name; alternatively, the first and second electrodes may be,
the target database is a relational database, and the configuration information further includes: the network domain name or IP of the target database, and the library name.
21. A terminal for querying data based on configuration information, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a data query method as claimed in any one of claims 1-10.
22. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the data query method according to any one of claims 1 to 10.
CN201710631092.7A 2017-07-28 2017-07-28 Data query method and device based on configuration information Active CN110019350B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710631092.7A CN110019350B (en) 2017-07-28 2017-07-28 Data query method and device based on configuration information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710631092.7A CN110019350B (en) 2017-07-28 2017-07-28 Data query method and device based on configuration information

Publications (2)

Publication Number Publication Date
CN110019350A CN110019350A (en) 2019-07-16
CN110019350B true CN110019350B (en) 2021-06-29

Family

ID=67186007

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710631092.7A Active CN110019350B (en) 2017-07-28 2017-07-28 Data query method and device based on configuration information

Country Status (1)

Country Link
CN (1) CN110019350B (en)

Families Citing this family (31)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110427188B (en) * 2019-08-02 2023-06-09 深圳前海微众银行股份有限公司 Configuration method, device, equipment and storage medium of single-test assertion program
CN110781208B (en) * 2019-09-27 2022-02-11 支付宝(杭州)信息技术有限公司 Data processing method, device, equipment and computer readable storage medium
CN110764769B (en) * 2019-10-21 2022-07-08 思必驰科技股份有限公司 Method and device for processing user request
CN110716960B (en) * 2019-10-22 2022-07-15 北京锐安科技有限公司 Database query method, device, equipment and storage medium
CN112783914B (en) * 2019-11-01 2023-09-01 北京京东振世信息技术有限公司 Method and device for optimizing sentences
CN112818202A (en) * 2019-11-18 2021-05-18 北京京东振世信息技术有限公司 Data query method and device
CN111198968A (en) * 2019-12-11 2020-05-26 中国建设银行股份有限公司 Data query method and device
CN111177183B (en) * 2019-12-24 2023-07-04 中国建设银行股份有限公司 Method and device for generating database access statement
CN111339140A (en) * 2020-02-21 2020-06-26 北京三快在线科技有限公司 Data query method and device, storage medium and electronic equipment
CN111597205B (en) * 2020-05-26 2024-02-13 北京金堤科技有限公司 Template configuration method, information extraction device, electronic equipment and medium
CN111767297B (en) * 2020-06-30 2023-07-04 深圳平安智慧医健科技有限公司 Big data processing method, device, equipment and medium
CN112035102A (en) * 2020-07-30 2020-12-04 海尔优家智能科技(北京)有限公司 Configuration method and device of data interface, storage medium and electronic device
CN112187849A (en) * 2020-08-06 2021-01-05 深圳市麦谷科技有限公司 Cache data dynamic generation method and system
CN111897849B (en) * 2020-08-21 2023-09-15 中国工商银行股份有限公司 Data query method and device
CN112347114A (en) * 2020-10-29 2021-02-09 有半岛(北京)信息科技有限公司 Data query system, data query method, data query device and server
CN112307068A (en) * 2020-11-10 2021-02-02 天元大数据信用管理有限公司 Dynamic SQL query method
CN112560420A (en) * 2020-12-08 2021-03-26 中国建设银行股份有限公司 Method and device for automatically generating report file
CN112559914A (en) * 2020-12-21 2021-03-26 北京搜房科技发展有限公司 Index data display method and device
CN112598289A (en) * 2020-12-25 2021-04-02 平安银行股份有限公司 Index configuration method, system, computer device and computer readable storage medium
CN112732734A (en) * 2020-12-31 2021-04-30 上海瑞家信息技术有限公司 Information processing method and device
CN112784139A (en) * 2021-01-13 2021-05-11 多点(深圳)数字科技有限公司 Query method, query device, electronic equipment and computer readable medium
CN112835573B (en) * 2021-01-27 2023-08-04 北京奇艺世纪科技有限公司 Data query method and device, electronic equipment and storage medium
CN113239044A (en) * 2021-05-18 2021-08-10 安翰科技(武汉)股份有限公司 Management device and application system of SQL records for query
CN113282585B (en) * 2021-05-28 2023-12-29 浪潮通用软件有限公司 Report calculation method, device, equipment and medium
CN113448980A (en) * 2021-06-18 2021-09-28 青岛海尔科技有限公司 Method and device for generating SQL (structured query language) statement and electronic equipment
CN113420051B (en) * 2021-06-30 2023-08-29 网易(杭州)网络有限公司 Data query method and device, electronic equipment and storage medium
CN113486116A (en) * 2021-07-07 2021-10-08 建信金融科技有限责任公司 Data synchronization method and device, electronic equipment and computer readable medium
CN113806504B (en) * 2021-08-27 2024-04-02 北京金蝶云基科技有限公司 Multi-dimensional report data calculation method and device and computer equipment
CN113641713A (en) * 2021-08-30 2021-11-12 北京沃东天骏信息技术有限公司 Data processing method and device
CN113918594A (en) * 2021-09-27 2022-01-11 苏宁易购集团股份有限公司 Method and device for generating structured query statement and computer equipment
CN115617859A (en) * 2022-12-16 2023-01-17 安徽华云安科技有限公司 Data query method and device based on knowledge graph cluster

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003065179A3 (en) * 2002-02-01 2003-11-06 John Fairweather A system and method for mining data
CN101216840A (en) * 2008-01-21 2008-07-09 金蝶软件(中国)有限公司 Data enquiry method and data enquiry system
CN102254008A (en) * 2011-07-18 2011-11-23 深圳证券信息有限公司 Method and system for setting dynamic data label
CN103823815A (en) * 2012-11-19 2014-05-28 中国联合网络通信集团有限公司 Server and database access method
CN105471931A (en) * 2014-08-06 2016-04-06 腾讯科技(北京)有限公司 Method, device and system for querying service data
CN105487864A (en) * 2015-11-26 2016-04-13 北京京东尚科信息技术有限公司 Method and device for automatically generating code
CN106202361A (en) * 2016-07-07 2016-12-07 上海携程商务有限公司 Data query method and system
CN106843878A (en) * 2017-01-20 2017-06-13 武汉斗鱼网络科技有限公司 A kind of model generating method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2536390C2 (en) * 2012-10-31 2014-12-20 Общество с ограниченной ответственностью "1С" Automated report generation method
US9626403B2 (en) * 2014-12-03 2017-04-18 Verizon Patent And Licensing Inc. Relational data model variant
CN104809254A (en) * 2015-05-19 2015-07-29 郑州悉知信息技术有限公司 Data query method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003065179A3 (en) * 2002-02-01 2003-11-06 John Fairweather A system and method for mining data
CN101216840A (en) * 2008-01-21 2008-07-09 金蝶软件(中国)有限公司 Data enquiry method and data enquiry system
CN102254008A (en) * 2011-07-18 2011-11-23 深圳证券信息有限公司 Method and system for setting dynamic data label
CN103823815A (en) * 2012-11-19 2014-05-28 中国联合网络通信集团有限公司 Server and database access method
CN105471931A (en) * 2014-08-06 2016-04-06 腾讯科技(北京)有限公司 Method, device and system for querying service data
CN105487864A (en) * 2015-11-26 2016-04-13 北京京东尚科信息技术有限公司 Method and device for automatically generating code
CN106202361A (en) * 2016-07-07 2016-12-07 上海携程商务有限公司 Data query method and system
CN106843878A (en) * 2017-01-20 2017-06-13 武汉斗鱼网络科技有限公司 A kind of model generating method and system

Also Published As

Publication number Publication date
CN110019350A (en) 2019-07-16

Similar Documents

Publication Publication Date Title
CN110019350B (en) Data query method and device based on configuration information
CN109683998B (en) Internationalization realization method, device and system
CN110263277B (en) Page data display method, page data updating device, page data equipment and storage medium
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN110851468A (en) Method and device for making simulation response to test request of client
CN110795315A (en) Method and device for monitoring service
CN110764796A (en) Method and device for updating cache
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
CN111338834A (en) Data storage method and device
CN111125064A (en) Method and device for generating database mode definition statement
CN113760948A (en) Data query method and device
CN111338944A (en) Remote Procedure Call (RPC) interface test method, device, medium and equipment
CN112948138A (en) Method and device for processing message
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN114896244A (en) Method, device and equipment for configuring database table and computer readable medium
CN112559001B (en) Method and device for updating application
CN110705935B (en) Logistics document processing method and device
CN110740046B (en) Method and device for analyzing service contract
CN113468342A (en) Data model construction method, device, equipment and medium based on knowledge graph
CN113779018A (en) Data processing method and device
CN113378346A (en) Method and device for model simulation
CN113760240A (en) Method and device for generating data model
US20180218064A1 (en) Method and system for the creation and maintenance of a web presence data store built automatically for all entities with a social media presence
CN112214500A (en) Data comparison method and device, electronic equipment and storage medium
CN113778909B (en) Method and device for caching data

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
GR01 Patent grant
GR01 Patent grant