WO2023116086A1 - 数据查询方法、装置、电子设备以及存储介质 - Google Patents

数据查询方法、装置、电子设备以及存储介质 Download PDF

Info

Publication number
WO2023116086A1
WO2023116086A1 PCT/CN2022/119727 CN2022119727W WO2023116086A1 WO 2023116086 A1 WO2023116086 A1 WO 2023116086A1 CN 2022119727 W CN2022119727 W CN 2022119727W WO 2023116086 A1 WO2023116086 A1 WO 2023116086A1
Authority
WO
WIPO (PCT)
Prior art keywords
query
engine
information
target
data
Prior art date
Application number
PCT/CN2022/119727
Other languages
English (en)
French (fr)
Inventor
宋传园
蔡俊辉
Original Assignee
北京百度网讯科技有限公司
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 北京百度网讯科技有限公司 filed Critical 北京百度网讯科技有限公司
Publication of WO2023116086A1 publication Critical patent/WO2023116086A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9532Query formulation
    • 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
    • G06F16/2445Data retrieval commands; View definitions
    • 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
    • G06F16/24553Query execution of query operations
    • G06F16/24558Binary matching operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9538Presentation of query results
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the disclosure involves the technical field of artificial intelligence, specifically the technical field of big data processing, which can be applied to scenarios such as data query.
  • a data query method including:
  • a data query device including:
  • the information acquisition module is used to acquire data query information in JOSN format, and the data query information is generated based on the user's selection operation on the query web page;
  • the engine determination module is used to determine the target query engine from at least one query engine based on the data query information
  • a request conversion module configured to convert data query information into a structured query language request suitable for accessing a target query engine
  • the result query module is used to send the structured query language request to the target query engine, and receive the data query result returned by the target query engine.
  • an electronic device including:
  • At least one processor and a memory communicatively coupled to the at least one processor;
  • the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the above data query method.
  • a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the above data query method.
  • a computer program product including a computer program, the computer program implements the above data query method when executed by a processor.
  • the technical solution of the present disclosure can allow the user to input query conditions in the form of selection operation in the graphical data query interface, and convert the data query information generated by the selection operation to obtain JSON format into a structured query language request suitable for accessing the query engine , so as to use the query engine to obtain the desired data.
  • FIG. 1 shows a schematic flowchart of a data query method provided by an embodiment of the present disclosure
  • FIG. 2 shows a schematic flowchart of another data query method provided by an embodiment of the present disclosure
  • Fig. 3 shows a schematic diagram of the graphical data query interface of the data query system
  • FIG. 4 shows one of the schematic diagrams of a data query device provided by an embodiment of the present disclosure
  • Fig. 5 shows the second schematic diagram of a data query device provided by an embodiment of the present disclosure
  • Fig. 6 shows a schematic block diagram of an example electronic device that can be used to implement the data query method provided by the embodiment of the present disclosure.
  • the data query method, device, electronic device, and storage medium provided by the embodiments of the present disclosure aim to solve at least one of the above technical problems in the prior art.
  • the data query method provided by the embodiments of the present disclosure may be applicable to a data query system that allows a user to manually select operations (such as click operations, drag operations, etc.).
  • the data query system can display a graphical data query interface. Users can input query conditions for data through selection operations on the data query interface.
  • the data query system can generate data query information in JOSN format based on the selection operation.
  • the data query method provided by the embodiment can convert the data query information in JOSN format into a structured query language request suitable for accessing the query engine, and send the structured query language request to the query engine, so that the user can be searched out through the query engine query. Expect the data to be queried, and return the result of the data query.
  • Fig. 1 shows a schematic flowchart of a data query method provided by an embodiment of the present disclosure. As shown in Fig. 1, the method may mainly include the following steps:
  • the data query information is generated based on the user's selection operation on the query webpage.
  • the data query system can display a data query interface. Users can input query conditions for data through selection operations on the data query interface.
  • the data query system can generate data query information in JOSN format based on the selection operation.
  • Embodiments of the present disclosure can Get the data query information in JSON format.
  • the selection operation includes at least one of the following: a click operation on the query control in the query web page, and a drag operation on the query control in the query web page.
  • the selection operation may also be another type of operation, which is not limited in the present disclosure.
  • S120 Based on the data query information, determine a target query engine from at least one query engine.
  • each query engine can support a corresponding query type, and the required query type can be determined through data query information, so as to match a corresponding target query engine from at least one query engine.
  • a mapping relationship between each of the at least one query engine and the corresponding query type may be established, and the mapping relationship between each query engine and the corresponding query type is stored in the mapping table middle.
  • the target query type may be parsed from the data query information, and the target query engine corresponding to the target query type is determined from at least one query engine. Specifically, after the target query type is parsed from the data query information, the target query engine corresponding to the target query type can be determined in the mapping table.
  • S130 Convert the data query information into a structured query language request suitable for accessing a target query engine.
  • Structured Query Language is a special-purpose programming language, a database query and programming language, used to access data and query, update and manage relational database systems (such as MySql , SQL Server, PostgreSQL), and also the extension of the database script file.
  • the data query information based on the JSON format cannot directly access the query request. It is necessary to convert the data query information in the JSON format into a structured query language request, and access the database through the structured query language request.
  • each query engine is suitable for The specific characteristics of the structured query language that are configured may vary slightly.
  • the features of the structured query language adapted to the query engine can be defined as query language features.
  • query language features When converting data query information into a structured query language request suitable for accessing the target query engine, it is necessary to take into account the features of the target query engine.
  • Query language features When converting data query information into a structured query language request suitable for accessing the target query engine, it is necessary to take into account the features of the target query engine.
  • Query language features can be determined; then based on the data query information and query language features, the data query information is converted into a structured query language request suitable for accessing the target query engine.
  • S140 Send a structured query language request to a target query engine, and receive a data query result returned by the target query engine.
  • the target query engine After sending the structured query language request to the target query engine, the target query engine queries the relevant data in the database based on the query conditions indicated by the structured query language request, and returns the data query result to the front end, so that the front end can display the data query result.
  • the data query method provided by the embodiment of the present disclosure can allow the user to input query conditions in the form of selection operation in the graphical data query interface, and convert the data query information generated by the selection operation into JSON format data suitable for accessing the query engine. Structured query language requests, so that the query engine can be used to obtain the expected data.
  • the above method helps to reduce the threshold for using data query and analysis scenarios, and helps to make data-driven decisions.
  • different query engines may correspond to different forwarding methods, such as different connection information encapsulation and/or connection methods.
  • this embodiment of the present disclosure may determine the target forwarding mode based on the engine type of the target query engine, and send the structured query language request to the target query engine through the target forwarding mode.
  • Fig. 2 shows a schematic flowchart of a data query method provided by an embodiment of the present disclosure. As shown in Fig. 2, the method may mainly include the following steps:
  • the data query information is generated based on the user's selection operation on the query webpage.
  • the data query system can display a data query interface. Users can input query conditions for data through selection operations on the data query interface.
  • the data query system can generate data query information in JOSN format based on the selection operation.
  • Embodiments of the present disclosure can Get the data query information in JSON format.
  • the selection operation includes at least one of the following: a click operation on the query control in the query web page, and a drag operation on the query control in the query web page.
  • the selection operation may also be another type of operation, which is not limited in the present disclosure.
  • S220 Parse out the target query type from the data query information, and determine a target query engine corresponding to the target query type from at least one query engine.
  • each query engine can support a corresponding query type, and the required query type can be determined through data query information, so as to match a corresponding target query engine from at least one query engine.
  • a mapping relationship between each of the at least one query engine and the corresponding query type may be established, and the mapping relationship between each query engine and the corresponding query type is stored in the mapping table middle.
  • the target query type may be parsed from the data query information, and then the target query engine corresponding to the target query type is determined in the mapping table.
  • the embodiment of the present disclosure can verify whether the data query information conforms to the standard grammar of the data query language, and continue to parse the data query information from the data query information when it is determined that the data query information conforms to the standard grammar of the data query language.
  • the target query type so that the data query information is converted into a java object defined by the data query language.
  • the query content is divided into modules to parse, and different keywords and function expressions are adapted according to different engine types during parsing.
  • different keywords and function expressions are adapted according to different engine types during parsing.
  • it can be optimized to improve query efficiency.
  • each query engine is suitable for The specific characteristics of the structured query language that are configured may vary slightly.
  • the features of the structured query language adapted to the query engine can be defined as query language features.
  • S240 Convert the data query information into a structured query language request suitable for accessing a target query engine based on the data query information and query language features.
  • step S240 at least one query content may be parsed from the data query information, keywords of the query content may be obtained based on query language features; and a Select syntax structure adapted to the data query information may be determined.
  • a structured query language request suitable for accessing the target query engine can be generated based on the keyword and the Select syntax structure.
  • the query content includes at least one of the following: Table information, custom query information, filter condition information, data grouping information, aggregation query information, joint query information, nested query information, sorting limit information, and row number limit information. It should be understood that the type of query content may not be limited thereto.
  • the keywords include at least one of the following: public keywords of structured query language, functions and keywords of custom expressions, functions and keywords of filtering filter expressions, functions and keywords of time type, functions and keywords of aggregation expressions Keywords, combined query keywords, combined query expressions, nested query keywords, nested query expressions, grouping keywords, keywords of field type grouping expressions, sorting limit keywords, and row limit keywords. It should be understood that the types of keywords may not be limited thereto.
  • the Select syntax structure can include a single-level structure and a multi-level nested structure. Fig.
  • the data query language in JOSN format can be PSQL (Palo Studio Query Language), and Palo Studio is a system with Palo as the main data Business intelligence tools for storage engines.
  • PSQL Physicalo Studio Query Language
  • Palo Studio is a system with Palo as the main data Business intelligence tools for storage engines.
  • "data” customers
  • the "Column option” in “Data” corresponds to the fields in the PSQL format, indicating the fields of the source table query, and the default is all fields.
  • "Association" corresponds to joins in PSQL, which means multi-table joint query, and there can be more than one.
  • Custom column corresponds to expressions in PSQL, which means custom expression column query, such as addition, subtraction, multiplication and division.
  • Filter corresponds to filter in PSQL, which means conditional filter query.
  • Aggregation corresponds to aggregation in PSQL, which means aggregation function query.
  • Columns grouped by selection corresponds to breakout in PSQL, which means field grouping query.
  • Sort corresponds to order-by in PSQL, indicating the sorting of query results.
  • Row limit corresponds to limit in PSQL, indicating the limit on the number of rows in the query result.
  • 1 to 9 are the complete content structure of a basic query. Nested queries can also be performed on the basis of the basic query. The basic structure of the nested query is consistent with the basic query, so soure-query in PSQL represents a nested query , and can be nested multiple levels.
  • step S240 can be implemented by a parser (Parser), and the parser can include multiple sub-parsers, and the multiple sub-parsers can include Table Parser, Field Parser, Expression Parser, Filter Parser, Breakout Parser, Aggregation Parser, etc.
  • Table Parser is used to parse Table information
  • Expression Parser is used to parse custom expressions
  • Filter Parser is used to parse filter conditions
  • Breakout Parser is used to parse data grouping information
  • Aggregation Parser is used to parse aggregation expressions.
  • Field Parser is a field parsing tool class that provides basic functions of field parsing for other sub-parsers.
  • the Select grammatical structure may be a single-layer query structure or a nested query structure.
  • the embodiment of the present disclosure may optimize the nested query structure, based on the keywords and The optimized nested query structure generates a structured query language request suitable for accessing the target query engine.
  • the optimized nested query structure generates a structured query language request suitable for accessing the target query engine.
  • the fewer layers of statement nesting in the structured query language request the higher the efficiency of the data query request. Therefore, when constructing a structured query language request, the number of nesting layers can be optimized without changing the semantics.
  • a nested query is also called a subquery, which refers to inserting a subquery statement in the where condition statement of the parent query, and the connection query can be completed with a subquery, and vice versa.
  • S250 Determine the target forwarding mode based on the engine type of the target query engine.
  • mapping relationship between the engine type of each query engine and the corresponding forwarding mode can be stored in advance, and step S250 can determine the target forwarding mode corresponding to the target query engine through the mapping relationship.
  • S260 Send the structured query language request to the target query engine by means of target forwarding.
  • S270 Receive the data query result returned by the target query engine.
  • the target query engine After sending the structured query language request to the target query engine, the target query engine queries the relevant data in the database based on the query conditions indicated by the structured query language request, and returns the data query result to the front end, so that the front end can display the data query result.
  • the embodiment of the present disclosure also provides a data query device.
  • FIG. 4 shows one of the schematic diagrams of a data query device provided by the embodiment of the present disclosure.
  • FIG. 5 shows The second schematic diagram of a data query device provided by an embodiment of the present disclosure.
  • the data query device 400 includes an information acquisition module 410 , an engine determination module 420 , a request conversion module 430 and a result query module 440 .
  • the information acquisition module 410 is used to acquire data query information in JOSN format, and the data query information is generated based on the user's selection operation on the query web page.
  • the engine determining module 420 is configured to determine a target query engine from at least one query engine based on data query information.
  • the request conversion module 430 is used to convert the data query information into a structured query language request suitable for accessing the target query engine.
  • the result query module 440 is used to send the structured query language request to the target query engine, and receive the data query result returned by the target query engine.
  • the data query device provided by the embodiments of the present disclosure can allow users to input query conditions in the form of selection operations in the graphical data query interface, and convert the data query information generated by the selection operations into JOSN format data suitable for accessing the query engine. Structured query language requests, so that the query engine can be used to obtain the expected data.
  • the above method helps to reduce the threshold for using data query and analysis scenarios, and helps to make data-driven decisions.
  • the data query device 400 may include an information mapping module 450 in addition to an information acquisition module 410 , an engine determination module 420 , a request conversion module 430 and a result query module 440 .
  • the information mapping module 450 is used to establish a mapping relationship between each query engine in at least one query engine and a corresponding query type.
  • the engine determination module 420 when used to determine the target query engine from at least one query engine based on the data query information, it is specifically used to: parse out the target query type from the data query information, and from at least one query engine The engine determines the target query engine corresponding to the target query type.
  • the request conversion module 430 when used to convert the data query information into a structured query language request suitable for accessing the target query engine, it is specifically used to:
  • the data query information is converted into a structured query language request suitable for accessing a target query engine.
  • the request conversion module 430 when the request conversion module 430 is used to convert the data query information into a structured query language request suitable for accessing the target query engine based on the data query information and query language features, it is specifically used to:
  • the query content includes at least one of the following: Table information, custom query information, filter condition information, data grouping information, aggregation query information, joint query information, nested query information, sorting limit information, row count Restrict information. It should be understood that the type of query content may not be limited thereto.
  • the keywords include at least one of the following: common keywords of structured query language, functions and keywords of custom expressions, functions and keywords of filter expressions, time type functions and keywords , functions and keywords of aggregate expressions, joint query keywords, joint query expressions, nested query keywords, nested query expressions, grouping keywords, keywords of field type grouping expressions, sorting restriction keywords, Line limit keyword.
  • the request conversion module when used to generate a structured query language request suitable for accessing the target query engine based on the keyword and the Select syntax structure, it is specifically used for:
  • a structured query language request suitable for accessing a target query engine is generated.
  • the result query module 440 when used to send the structured query language request to the target query engine, it is specifically used for:
  • the selection operation includes at least one of the following: a click operation on the query control in the query web page, and a drag operation on the query control in the query web page.
  • the above-mentioned modules of the data query device in the embodiments of the present disclosure have the function of implementing the corresponding steps of the above-mentioned data query method.
  • This function may be implemented by hardware, or may be implemented by executing corresponding software on the hardware.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the above-mentioned modules may be software and/or hardware, and each of the above-mentioned modules may be realized independently, or multiple modules may be integrated and realized.
  • For the functional description of each module of the above-mentioned data query device please refer to the corresponding description of the above-mentioned data query method, which will not be repeated here.
  • the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
  • FIG. 6 shows a schematic block diagram of an example electronic device that may be used to implement embodiments of the present disclosure.
  • Electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers.
  • Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions, are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.
  • the device 600 includes a computing unit 601 that can execute according to a computer program stored in a read-only memory (ROM) 602 or loaded from a storage unit 608 into a random-access memory (RAM) 603. Various appropriate actions and treatments. In the RAM 603, various programs and data necessary for the operation of the device 600 can also be stored.
  • the computing unit 601, ROM 602, and RAM 603 are connected to each other through a bus 604.
  • An input/output (I/O) interface 605 is also connected to the bus 604 .
  • the I/O interface 605 includes: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disk, etc. ; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, and the like.
  • the communication unit 609 allows the device 600 to exchange information/data with other devices over a computer network such as the Internet and/or various telecommunication networks.
  • the computing unit 601 may be various general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of computing units 601 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processing processor (DSP), and any suitable processor, controller, microcontroller, etc.
  • the computing unit 601 executes various methods and processes described above, such as data query methods.
  • the data query method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608 .
  • part or all of the computer program may be loaded and/or installed on the device 600 via the ROM 602 and/or the communication unit 609.
  • the computer program When the computer program is loaded into RAM 603 and executed by computing unit 601, one or more steps of the data query method described above can be performed.
  • the computing unit 601 may be configured to execute the data query method in any other suitable manner (for example, by means of firmware).
  • Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips Implemented in a system of systems (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or combinations thereof.
  • FPGAs field programmable gate arrays
  • ASICs application specific integrated circuits
  • ASSPs application specific standard products
  • SOC system of systems
  • CPLD load programmable logic device
  • computer hardware firmware, software, and/or combinations thereof.
  • programmable processor can be special-purpose or general-purpose programmable processor, can receive data and instruction from storage system, at least one input device, and at least one output device, and transmit data and instruction to this storage system, this at least one input device, and this at least one output device an output device.
  • Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special purpose computer, or other programmable data processing devices, so that the program codes, when executed by the processor or controller, make the functions/functions specified in the flow diagrams and/or block diagrams Action is implemented.
  • the program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user. ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer.
  • a display device e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor
  • a keyboard and pointing device eg, a mouse or a trackball
  • Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, speech input or, tactile input) to receive input from the user.
  • the systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., as a a user computer having a graphical user interface or web browser through which a user can interact with embodiments of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system.
  • the components of the system can be interconnected by any form or medium of digital data communication, eg, a communication network. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN) and the Internet.
  • a computer system may include clients and servers.
  • Clients and servers are generally remote from each other and typically interact through a communication network.
  • the relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other.
  • the server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
  • steps may be reordered, added or deleted using the various forms of flow shown above.
  • each step described in the present disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in the present disclosure can be achieved, no limitation is imposed herein.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本公开提供了一种数据查询方法、装置、电子设备以及存储介质,本公开涉及人工智能技术领域,具体涉及大数据处理的技术领域,可以应用于数据查询等场景。具体实现方案为:获取JOSN格式的数据查询信息;基于数据查询信息,从至少一个查询引擎中确定出目标查询引擎;将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求;将结构化查询语言请求发送至目标查询引擎,接收目标查询引擎返回的数据查询结果。上述可以允许用户在图形化的数据查询界面中以选择操作的方式输入查询条件,将选择操作生成的获取JOSN格式的数据查询信息转换为适于访问查询引擎的结构化查询语言请求,从而利用查询引擎获取期望的数据。

Description

数据查询方法、装置、电子设备以及存储介质
本公开要求申请号为202111588587.9,申请日为2021年12月23日,名称为“数据查询方法、装置、电子设备以及存储介质”的中国专利申请的优先权,其中,上述专利申请公开的内容通过引用结合在本公开中。
技术领域
公开涉及人工智能技术领域,具体涉及大数据处理的技术领域,可以应用于数据查询等场景。
背景技术
在现有的数据查询场景中,需要数据分析人员掌握SQL,或者需要前端开发人员针对不同的引擎进行特定化开发,或者需要后端开发人员需要掌握使用范围较小的语言,对于大部分后端的开发不够友好。
发明内容
提供了一种数据查询方法、装置、电子设备以及存储介质。
根据本公开的第一方面,提供了一种数据查询方法,包括:
获取JOSN格式的数据查询信息,数据查询信息是基于用户在查询网页上的选择操作生成的;
基于数据查询信息,从至少一个查询引擎中确定出目标查询引擎;
将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求;
将结构化查询语言请求发送至目标查询引擎,接收目标查询引擎返回的数据查询结果。
根据本公开的第二方面,提供了一种数据查询装置,包括:
信息获取模块,用于获取JOSN格式的数据查询信息,数据查询信息是基于用户在查询网页上的选择操作生成的;
引擎确定模块,用于基于数据查询信息,从至少一个查询引擎中确定 出目标查询引擎;
请求转换模块,用于将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求;
结果查询模块,用于将结构化查询语言请求发送至目标查询引擎,接收目标查询引擎返回的数据查询结果。
根据本公开的第三方面,提供了一种电子设备,包括:
至少一个处理器;以及与所述至少一个处理器通信连接的存储器;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述的数据查询方法。
根据本公开的第四方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行上述的数据查询方法。
根据本公开的第五方面,提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现上述的数据查询方法。
应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。
本公开提供的技术方案带来的有益效果是:
本公开的技术方案可以允许用户在图形化的数据查询界面中以选择操作的方式输入查询条件,将选择操作生成的获取JOSN格式的数据查询信息转换为适于访问查询引擎的结构化查询语言请求,从而利用查询引擎获取期望的数据。
附图说明
附图用于更好地理解本方案,不构成对本公开的限定。其中:
图1示出了本公开实施例提供的一种数据查询方法的流程示意图;
图2示出了本公开实施例提供的另一种数据查询方法的流程示意图;
图3示出了数据查询系统的图形化的数据查询界面的示意图
图4示出了本公开实施例提供的一种数据查询装置的示意图之一;
图5示出了本公开实施例提供的一种数据查询装置的示意图之二;
图6示出了可以用来实施本公开实施例提供的数据查询方法的示例电子设备的示意性框图。
具体实施方式
以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
在现有的数据查询场景中,需要数据分析人员掌握SQL,或者需要前端开发人员针对不同的引擎进行特定化开发,或者需要后端开发人员需要掌握使用范围较小的语言,对于大部分后端的开发不够友好。
本公开实施例提供的数据查询方法、装置、电子设备以及存储介质,旨在解决现有技术的如上技术问题中的至少一个。
本公开实施例提供的数据查询方法,可以适用于一种能够允许用户通过手动的选择操作(如点击操作和拖拽操作等)的数据查询系统。具体来说,数据查询系统可以展示图形化的数据查询界面,用户可以在数据查询界面通过选择操作来输入针对数据的查询条件,数据查询系统可以基于选择操作生成JOSN格式的数据查询信息,本公开实施例提供的数据查询方法可以将JOSN格式的数据查询信息转换为适于访问查询引擎的结构化查询语言请求,并将该结构化查询语言请求发送给查询引擎,以便通过查询引擎查询搜索出用户期望查询的数据,并将数据查询结果返回。
图1示出了本公开实施例提供的一种数据查询方法的流程示意图,如图1所示,该方法主要可以包括以下步骤:
S110:获取JOSN格式的数据查询信息。
在本公实施例中,数据查询信息是基于用户在查询网页上的选择操作生成的。具体来说,数据查询系统可以展示数据查询界面,用户可以在数据查询界面通过选择操作来输入针对数据的查询条件,数据查询系统可以基于选择操作生成JOSN格式的数据查询信息,本公开实施例可以获取该 JOSN格式的数据查询信息。这里,选择操作包括以下至少一项:针对查询网页中查询控件的点击操作、针对查询网页中查询控件的拖拽操作。当然,选择操作也可以是其他类型的操作,本公开对此不作限制。
S120:基于数据查询信息,从至少一个查询引擎中确定出目标查询引擎。
可以理解,每种查询引擎可以支持对应的查询类型,通过数据查询信息可以确定其需要的查询类型,从而从至少一个查询引擎中匹配出对应的目标查询引擎。可选地,本公开实施例在步骤S120之前,可以建立至少一个查询引擎中的每个查询引擎与对应的查询类型的映射关系,将各查询引擎与对应的查询类型的映射关系保存在映射表中。在步骤S120中,可以从数据查询信息解析出目标查询类型,从至少一个查询引擎中确定出与目标查询类型对应的目标查询引擎。具体来说,在从数据查询信息解析出目标查询类型之后,可以在映射表中确定出与该目标查询类型对应的目标查询引擎。
S130:将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求。
这里,结构化查询语言(Structured Query Language,SQL),是一种特殊目的的编程语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统(如MySql、SQL Server、PostgreSQL),同时也是数据库脚本文件的扩展名。这里,基于JOSN格式的数据查询信息无法直接访问查询请求,需要将JOSN格式的数据查询信息转换为结构化查询语言请求,通过结构化查询语言请求来访问数据库。
在此需要说明的是,各个查询引擎所适配的结构化查询语言的标准语法大多一致,但是不同类型的查询引擎会适配一些结构化查询语言中的不同方言,因此,各个查询引擎所适配的结构化查询语言的具体特点可能略有差异。这里,可以将查询引擎所适配的结构化查询语言的特征定义为查询语言特征,在将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求时,需要考虑到目标查询引擎的查询语言特征。可选地,在步骤S130中,可以确定出目标查询引擎对应的查询语言特征;之后基于数据查询信息和查询语言特征,将数据查询信息转换为适于访问目标查询引 擎的结构化查询语言请求。
S140:将结构化查询语言请求发送至目标查询引擎,接收目标查询引擎返回的数据查询结果。
在将结构化查询语言请求发送至目标查询引擎之后,目标查询引擎基于结构化查询语言请求所指示的查询条件在数据库中查询出相关的数据,并将数据查询结果返回前端,以便前端展示数据查询结果。
本公开实施例提供的数据查询方法,可以允许用户在图形化的数据查询界面中以选择操作的方式输入查询条件,将选择操作生成的获取JOSN格式的数据查询信息转换为适于访问查询引擎的结构化查询语言请求,从而利用查询引擎获取期望的数据,上述方法有助于降低数据查询和分析场景的使用门槛,有助于以数据驱动做出决策。
在此需要说明的是,不同的查询引擎可能对应不同的转发方式,比如连接信息封装和/或连接方式不同。可选地,本公开实施例可以基于目标查询引擎的引擎类型确定目标转发方式,通过目标转发方式将结构化查询语言请求发送至目标查询引擎。
图2示出了本公开实施例提供的一种数据查询方法的流程示意图,如图2所示,该方法主要可以包括以下步骤:
S210:获取JOSN格式的数据查询信息。
在本公实施例中,数据查询信息是基于用户在查询网页上的选择操作生成的。具体来说,数据查询系统可以展示数据查询界面,用户可以在数据查询界面通过选择操作来输入针对数据的查询条件,数据查询系统可以基于选择操作生成JOSN格式的数据查询信息,本公开实施例可以获取该JOSN格式的数据查询信息。这里,选择操作包括以下至少一项:针对查询网页中查询控件的点击操作、针对查询网页中查询控件的拖拽操作。当然,选择操作也可以是其他类型的操作,本公开对此不作限制。
S220:从数据查询信息解析出目标查询类型,从至少一个查询引擎中确定出与目标查询类型对应的目标查询引擎。
可以理解,每种查询引擎可以支持对应的查询类型,通过数据查询信息可以确定其需要的查询类型,从而从至少一个查询引擎中匹配出对应的目标查询引擎。可选地,本公开实施例在步骤S220之前,可以建立至少 一个查询引擎中的每个查询引擎与对应的查询类型的映射关系,将各查询引擎与对应的查询类型的映射关系保存在映射表中。在步骤S220中,可以从数据查询信息解析出目标查询类型,之后在映射表中确定出与该目标查询类型对应的目标查询引擎。
本公开实施例可以根据JOSN格式的数据查询语言的定义,校验数据查询信息是否符合数据查询语言的标准语法,在确定数据查询信息符合数据查询语言的标准语法时,继续从数据查询信息解析出目标查询类型,从而将数据查询信息转换成数据查询语言定义的java对象。
基于该java对象对查询内容分模块去解析,解析时根据不同的引擎类型去适配不同的关键字和函数表达式等内容。对于嵌套查询结构,可对其进行优化以提高查询的效率。本段内容的具体过程参见后续的步骤S230和步骤S240。
S230:确定出目标查询引擎对应的查询语言特征。
在此需要说明的是,各个查询引擎所适配的结构化查询语言的标准语法大多一致,但是不同类型的查询引擎会适配一些结构化查询语言中的不同方言,因此,各个查询引擎所适配的结构化查询语言的具体特点可能略有差异。这里,可以将查询引擎所适配的结构化查询语言的特征定义为查询语言特征,在将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求时,需要考虑到目标查询引擎的查询语言特征,因此需要在步骤S230确定目标查询引擎对应的查询语言特征,以便将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求
S240:基于数据查询信息和查询语言特征,将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求。
可选地,在步骤S240中,可以从数据查询信息中解析出至少一种查询内容,基于查询语言特征获取查询内容的关键字;确定出与数据查询信息适配的Select语法结构。在确定出关键字和Select语法结构之后,可以基于关键字和Select语法结构,生成适于访问目标查询引擎的结构化查询语言请求。这里,查询内容包括以下至少一项:Table信息、自定义查询信息、过滤条件信息、数据分组信息、聚合查询信息、联合查询信息、嵌套查询信息、排序限制信息、行数限制信息。应当理解,查询内容的类型 可以不限于此。关键字包括以下至少一项:结构化查询语言公共的关键字、自定义表达式的函数和关键字、过滤筛选表达式的函数和关键字、时间类型函数和关键字、聚合表达式的函数和关键字、联合查询关键字、联合查询表达方式、嵌套查询关键字、嵌套查询表达方式、分组关键字、字段类型分组表达式的关键字、排序限制关键字、行数限制关键字。应当理解,关键字的类型可以不限于此。Select语法结构可以包括单层结构和多层嵌套结构。图3示出了数据查询系统的图形化的数据查询界面的示意图,在本公开实施例中JOSN格式的数据查询语言可以是PSQL(Palo Studio Query Language),Palo Studio是一个以Palo做为主要数据存储引擎的商业智能工具。其中,“数据”(customers)对应PSQL格式中的source-table,表示要查询的源表。“数据”中的“列选项”对应PSQL格式中的fields,表示源表查询的字段,默认是全部字段。“关联”对应PSQL中的joins,表示多表联合查询,可以有多个。“自定义列”对应PSQL中的expressions,表示自定义表达式列查询,比如加减乘除等。“筛选”对应PSQL中的filter,表示条件过滤查询。“聚合”对应PSQL中的aggregation,表示聚合函数查询。“通过选择分组的列”对应PSQL中的breakout,表示字段分组查询。“排序”对应PSQL中的order-by,表示查询结果排序。“行限制”对应PSQL中的limit,表示查询结果行数限制。1到9是一个基础查询的完整内容结构,在基础查询的基础上还可以进行嵌套查询,嵌套查询的基本结构跟基础查询一致,所以PSQL中的soure-query表示的是一个嵌套查询,并且可以嵌套多层。
可选地,步骤S240可以通过解析器(Parser)实现,解析器可以包含多个子解析器,多个子解析器可以包括Table Parser、Field Parser、Expression Parser、Filter Parser、Breakout Parser、Aggregation Parser等。Table Parser用于解析Table信息,Expression Parser用于解析自定义表达式,Filter Parser用于解析过滤条件,Breakout Parser用于解析数据分组信息,Aggregation Parser用于解析聚合表达式。Field Parser为字段解析工具类,会为其他子解析器提供字段解析的基础功能。
可以理解,Select语法结构可以是单层查询结构或嵌套查询结构,当所述Select语法结构为嵌套查询结构时,本公开实施例可以对嵌套查询结 构进行优化,基于所述关键字和优化后的所述嵌套查询结构,生成适于访问所述目标查询引擎的结构化查询语言请求。可以理解,结构化查询语言请求中语句的嵌套的层数越少,数据查询请求的效率越高。因此,在构造结构化查询语言请求时可以在不改变语义的前提下进行嵌套层数的优化,比如针对自定义表达式的嵌套结构,是可以直接优化成自定义表达式作为字段进行查询。这里,嵌套查询又称子查询,是指在父查询的where条件语句中再插入一个子查询语句,连接查询都可以用子查询完成,反之不然。
S250:基于目标查询引擎的引擎类型确定目标转发方式。
在此需要说明的是,不同的查询引擎可能对应不同的转发方式,比如连接信息封装和/或连接方式不同。可以预先存储每个查询引擎的引擎类型与对应的转发方式的映射关系,步骤S250可以通过该映射关系确定出目标查询引擎对应的目标转发方式。
S260:通过目标转发方式将结构化查询语言请求发送至目标查询引擎。
S270:接收目标查询引擎返回的数据查询结果。
在将结构化查询语言请求发送至目标查询引擎之后,目标查询引擎基于结构化查询语言请求所指示的查询条件在数据库中查询出相关的数据,并将数据查询结果返回前端,以便前端展示数据查询结果。
基于与上述的数据查询方法相同的原理,本公开实施例还提供了一种数据查询装置,图4示出了本公开实施例提供的一种数据查询装置的示意图之一,图5示出了本公开实施例提供的一种数据查询装置的示意图之二。如图3所示,数据查询装置400包括信息获取模块410、引擎确定模块420、请求转换模块430和结果查询模块440。
信息获取模块410用于获取JOSN格式的数据查询信息,数据查询信息是基于用户在查询网页上的选择操作生成的。
引擎确定模块420用于基于数据查询信息,从至少一个查询引擎中确定出目标查询引擎。
请求转换模块430用于将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求。
结果查询模块440用于将结构化查询语言请求发送至目标查询引擎,接收目标查询引擎返回的数据查询结果。
本公开实施例提供的数据查询装置,可以允许用户在图形化的数据查询界面中以选择操作的方式输入查询条件,将选择操作生成的获取JOSN格式的数据查询信息转换为适于访问查询引擎的结构化查询语言请求,从而利用查询引擎获取期望的数据,上述方法有助于降低数据查询和分析场景的使用门槛,有助于以数据驱动做出决策。
在本公开实施例中,如图4所示,数据查询装置400在包括信息获取模块410、引擎确定模块420、请求转换模块430和结果查询模块440的基础上,还可以包括信息映射模块450。信息映射模块450用于建立至少一个查询引擎中的每个查询引擎与对应的查询类型的映射关系。
在本公开实施例中,引擎确定模块420在用于基于数据查询信息,从至少一个查询引擎中确定出目标查询引擎时,具体用于:从数据查询信息解析出目标查询类型,从至少一个查询引擎中确定出与目标查询类型对应的目标查询引擎。
在本公开实施例中,请求转换模块430在用于将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求时,具体用于:
确定出目标查询引擎对应的查询语言特征;
基于数据查询信息和查询语言特征,将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求。
在本公开实施例中,请求转换模块430在用于基于数据查询信息和查询语言特征,将数据查询信息转换为适于访问目标查询引擎的结构化查询语言请求时,具体用于:
从数据查询信息中解析出至少一种查询内容,基于查询语言特征获取查询内容的关键字;
确定出与数据查询信息适配的Select语法结构;
基于关键字和Select语法结构,生成适于访问目标查询引擎的结构化查询语言请求。
在本公开实施例中,查询内容包括以下至少一项:Table信息、自定义查询信息、过滤条件信息、数据分组信息、聚合查询信息、联合查询信息、嵌套查询信息、排序限制信息、行数限制信息。应当理解,查询内容的类型可以不限于此。
在本公开实施例中,关键字包括以下至少一项:结构化查询语言公共的关键字、自定义表达式的函数和关键字、过滤筛选表达式的函数和关键字、时间类型函数和关键字、聚合表达式的函数和关键字、联合查询关键字、联合查询表达方式、嵌套查询关键字、嵌套查询表达方式、分组关键字、字段类型分组表达式的关键字、排序限制关键字、行数限制关键字。
在本公开实施例中,请求转换模块在用于基于关键字和Select语法结构,生成适于访问目标查询引擎的结构化查询语言请求时,具体用于:
当Select语法结构为嵌套查询结构时,对嵌套查询结构进行优化;
基于关键字和优化后的嵌套查询结构,生成适于访问目标查询引擎的结构化查询语言请求。
在本公开实施例中,结果查询模块440在用于将结构化查询语言请求发送至目标查询引擎时,具体用于:
基于目标查询引擎的引擎类型确定目标转发方式;
通过目标转发方式将结构化查询语言请求发送至目标查询引擎。
在本公开实施例中,选择操作包括以下至少一项:针对查询网页中查询控件的点击操作、针对查询网页中查询控件的拖拽操作。
可以理解的是,本公开实施例中的数据查询装置的上述各模块具有实现上述的数据查询方法相应步骤的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。上述模块可以是软件和/或硬件,上述各模块可以单独实现,也可以多个模块集成实现。对于上述数据查询装置的各模块的功能描述具体可以参见上述的数据查询方法的对应描述,在此不再赘述。
本公开的技术方案中,所涉及的用户个人信息的收集、存储、使用、加工、传输、提供和公开等处理,均符合相关法律法规的规定,且不违背公序良俗。
根据本公开的实施例,本公开还提供了一种电子设备、一种可读存储介质和一种计算机程序产品。
图6示出了可以用来实施本公开的实施例的示例电子设备的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、 和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。
如图6所示,设备600包括计算单元601,其可以根据存储在只读存储器(ROM)602中的计算机程序或者从存储单元608加载到随机访问存储器(RAM)603中的计算机程序,来执行各种适当的动作和处理。在RAM 603中,还可存储设备600操作所需的各种程序和数据。计算单元601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。
设备600中的多个部件连接至I/O接口605,包括:输入单元606,例如键盘、鼠标等;输出单元607,例如各种类型的显示器、扬声器等;存储单元608,例如磁盘、光盘等;以及通信单元609,例如网卡、调制解调器、无线通信收发机等。通信单元609允许设备600通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。
计算单元601可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元601的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元601执行上文所描述的各个方法和处理,例如数据查询方法。例如,在一些实施例中,数据查询方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元608。在一些实施例中,计算机程序的部分或者全部可以经由ROM 602和/或通信单元609而被载入和/或安装到设备600上。当计算机程序加载到RAM 603并由计算单元601执行时,可以执行上文描述的数据查询方法的一个或多个步骤。备选地,在其他实施例中,计算单元601可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行数据查询方法。
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设 备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉 反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,也可以为分布式系统的服务器,或者是结合了区块链的服务器。
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。
上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。

Claims (21)

  1. 一种数据查询方法,包括:
    获取JOSN格式的数据查询信息,所述数据查询信息是基于用户在查询网页上的选择操作生成的;
    基于所述数据查询信息,从至少一个查询引擎中确定出目标查询引擎;
    将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求;
    将所述结构化查询语言请求发送至所述目标查询引擎,接收所述目标查询引擎返回的数据查询结果。
  2. 根据权利要求1所述的方法,
    在所述基于所述数据查询信息,从至少一个查询引擎中确定出目标查询引擎之前,还包括:建立至少一个查询引擎中的每个查询引擎与对应的查询类型的映射关系;
    所述基于所述数据查询信息,从至少一个查询引擎中确定出目标查询引擎,包括:从所述数据查询信息解析出目标查询类型,从所述至少一个查询引擎中确定出与所述目标查询类型对应的目标查询引擎。
  3. 根据权利要求1所述的方法,其中,所述将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求,包括:
    确定出所述目标查询引擎对应的查询语言特征;
    基于所述数据查询信息和所述查询语言特征,将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求。
  4. 根据权利要求3所述的方法,其中,所述基于所述数据查询信息和所述查询语言特征,将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求,包括:
    从所述数据查询信息中解析出至少一种查询内容,基于所述查询语言特征获取所述查询内容的关键字;
    确定出与所述数据查询信息适配的Select语法结构;
    基于所述关键字和所述Select语法结构,生成适于访问所述目标查询引擎的结构化查询语言请求。
  5. 根据权利要求4所述的方法,所述查询内容包括以下至少一项:Table信息、自定义查询信息、过滤条件信息、数据分组信息、聚合查询信息、联合查询信息、嵌套查询信息、排序限制信息、行数限制信息。
  6. 根据权利要求4所述的方法,所述关键字包括以下至少一项:结构化查询语言公共的关键字、自定义表达式的函数和关键字、过滤筛选表达式的函数和关键字、时间类型函数和关键字、聚合表达式的函数和关键字、联合查询关键字、联合查询表达方式、嵌套查询关键字、嵌套查询表达方式、分组关键字、字段类型分组表达式的关键字、排序限制关键字、行数限制关键字。
  7. 根据权利要求4所述的方法,所述基于所述关键字和所述Select语法结构,生成适于访问所述目标查询引擎的结构化查询语言请求,包括:
    当所述Select语法结构为嵌套查询结构时,对所述嵌套查询结构进行优化;
    基于所述关键字和优化后的所述嵌套查询结构,生成适于访问所述目标查询引擎的结构化查询语言请求。
  8. 根据权利要求1所述的方法,所述将所述结构化查询语言请求发送至所述目标查询引擎,包括:
    基于所述目标查询引擎的引擎类型确定目标转发方式;
    通过所述目标转发方式将所述结构化查询语言请求发送至所述目标查询引擎。
  9. 根据权利要求1所述的方法,所述选择操作包括以下至少一项:针对所述查询网页中查询控件的点击操作、针对所述查询网页中查询控件的拖拽操作。
  10. 一种数据查询装置,包括:
    信息获取模块,用于获取JOSN格式的数据查询信息,所述 数据查询信息是基于用户在查询网页上的选择操作生成的;
    引擎确定模块,用于基于所述数据查询信息,从至少一个查询引擎中确定出目标查询引擎;
    请求转换模块,用于将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求;
    结果查询模块,用于将所述结构化查询语言请求发送至所述目标查询引擎,接收所述目标查询引擎返回的数据查询结果。
  11. 根据权利要求10所述的装置,还包括信息映射模块,所述信息映射模块用于:建立至少一个查询引擎中的每个查询引擎与对应的查询类型的映射关系;
    所述引擎确定模块在用于基于所述数据查询信息,从至少一个查询引擎中确定出目标查询引擎时,具体用于:从所述数据查询信息解析出目标查询类型,从所述至少一个查询引擎中确定出与所述目标查询类型对应的目标查询引擎。
  12. 根据权利要求10所述的装置,其中,所述请求转换模块在用于将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求时,具体用于:
    确定出所述目标查询引擎对应的查询语言特征;
    基于所述数据查询信息和所述查询语言特征,将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求。
  13. 根据权利要求12所述的装置,其中,所述请求转换模块在用于基于所述数据查询信息和所述查询语言特征,将所述数据查询信息转换为适于访问所述目标查询引擎的结构化查询语言请求时,具体用于:
    从所述数据查询信息中解析出至少一种查询内容,基于所述查询语言特征获取所述查询内容的关键字;
    确定出与所述数据查询信息适配的Select语法结构;
    基于所述关键字和所述Select语法结构,生成适于访问所述目标查询引擎的结构化查询语言请求。
  14. 根据权利要求13所述的装置,所述查询内容包括以下至少一项:Table信息、自定义查询信息、过滤条件信息、数据分组信息、聚合查询信息、联合查询信息、嵌套查询信息、排序限制信息、行数限制信息。
  15. 根据权利要求13所述的装置,所述关键字包括以下至少一项:结构化查询语言公共的关键字、自定义表达式的函数和关键字、过滤筛选表达式的函数和关键字、时间类型函数和关键字、聚合表达式的函数和关键字、联合查询关键字、联合查询表达方式、嵌套查询关键字、嵌套查询表达方式、分组关键字、字段类型分组表达式的关键字、排序限制关键字、行数限制关键字。
  16. 根据权利要求13所述的方法,所述请求转换模块在用于基于所述关键字和所述Select语法结构,生成适于访问所述目标查询引擎的结构化查询语言请求时,具体用于:
    当所述Select语法结构为嵌套查询结构时,对所述嵌套查询结构进行优化;
    基于所述关键字和优化后的所述嵌套查询结构,生成适于访问所述目标查询引擎的结构化查询语言请求。
  17. 根据权利要求10所述的装置,所述结果查询模块在用于将所述结构化查询语言请求发送至所述目标查询引擎时,具体用于:
    基于所述目标查询引擎的引擎类型确定目标转发方式;
    通过所述目标转发方式将所述结构化查询语言请求发送至所述目标查询引擎。
  18. 根据权利要求1所述的装置,所述选择操作包括以下至少一项:针对所述查询网页中查询控件的点击操作、针对所述查询网页中查询控件的拖拽操作。
  19. 一种电子设备,包括:
    至少一个处理器;以及
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所 述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-9中任一项所述的数据查询方法。
  20. 一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行权利要求1-9中任一项所述的数据查询方法。
  21. 一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现权利要求1-9中任一项所述的数据查询方法。
PCT/CN2022/119727 2021-12-23 2022-09-19 数据查询方法、装置、电子设备以及存储介质 WO2023116086A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111588587.9 2021-12-23
CN202111588587.9A CN114357276B (zh) 2021-12-23 2021-12-23 数据查询方法、装置、电子设备以及存储介质

Publications (1)

Publication Number Publication Date
WO2023116086A1 true WO2023116086A1 (zh) 2023-06-29

Family

ID=81101502

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/119727 WO2023116086A1 (zh) 2021-12-23 2022-09-19 数据查询方法、装置、电子设备以及存储介质

Country Status (2)

Country Link
CN (1) CN114357276B (zh)
WO (1) WO2023116086A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116578585A (zh) * 2023-07-13 2023-08-11 北京原点数安科技有限公司 数据查询方法、装置、电子设备及存储介质

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114357276B (zh) * 2021-12-23 2023-08-22 北京百度网讯科技有限公司 数据查询方法、装置、电子设备以及存储介质
CN114896272A (zh) * 2022-06-15 2022-08-12 北京奇艺世纪科技有限公司 信息获取方法、装置、电子设备及计算机可读存储介质
CN114996539B (zh) * 2022-07-29 2022-11-01 昆仑智汇数据科技(北京)有限公司 一种信息处理方法、装置及设备
CN115563183B (zh) * 2022-09-22 2024-04-09 北京百度网讯科技有限公司 查询方法、装置及程序产品
CN115994146A (zh) * 2023-03-22 2023-04-21 烟台云朵软件有限公司 一种混合式数据存储引擎系统及数据存储方法、访问方法
CN116955366B (zh) * 2023-09-21 2023-12-22 宝略科技(浙江)有限公司 一种数据导入处理方法、系统、装置及存储介质
CN117290411B (zh) * 2023-11-22 2024-02-13 深圳九有数据库有限公司 一种多模数据库查询方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269792A (zh) * 2020-12-11 2021-01-26 腾讯科技(深圳)有限公司 数据查询方法、装置、设备及计算机可读存储介质
CN113377805A (zh) * 2021-08-13 2021-09-10 腾讯科技(深圳)有限公司 数据查询方法、装置、电子设备及计算机可读存储介质
CN113704291A (zh) * 2021-09-03 2021-11-26 北京火山引擎科技有限公司 数据查询方法、装置、存储介质及电子设备
CN114357276A (zh) * 2021-12-23 2022-04-15 北京百度网讯科技有限公司 数据查询方法、装置、电子设备以及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8788525B2 (en) * 2012-09-07 2014-07-22 Splunk Inc. Data model for machine data for semantic search
US10713248B2 (en) * 2017-07-23 2020-07-14 AtScale, Inc. Query engine selection
CN108520037B (zh) * 2018-03-30 2019-10-18 新华三大数据技术有限公司 数据查询方法、装置及数据可视化系统
CN112307061A (zh) * 2019-10-31 2021-02-02 北京京东尚科信息技术有限公司 用于查询数据的方法和装置
CN110825767A (zh) * 2019-11-15 2020-02-21 江苏满运软件科技有限公司 数据查询方法、平台、设备及存储介质
CN112905620B (zh) * 2019-11-19 2024-05-17 北京沃东天骏信息技术有限公司 数据查询方法及装置、电子设备、存储介质
CN111026931A (zh) * 2019-12-09 2020-04-17 中国建设银行股份有限公司 一种数据查询方法、装置、设备及介质
CN113672781A (zh) * 2021-08-20 2021-11-19 平安国际智慧城市科技股份有限公司 数据查询方法、装置、电子设备及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269792A (zh) * 2020-12-11 2021-01-26 腾讯科技(深圳)有限公司 数据查询方法、装置、设备及计算机可读存储介质
CN113377805A (zh) * 2021-08-13 2021-09-10 腾讯科技(深圳)有限公司 数据查询方法、装置、电子设备及计算机可读存储介质
CN113704291A (zh) * 2021-09-03 2021-11-26 北京火山引擎科技有限公司 数据查询方法、装置、存储介质及电子设备
CN114357276A (zh) * 2021-12-23 2022-04-15 北京百度网讯科技有限公司 数据查询方法、装置、电子设备以及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116578585A (zh) * 2023-07-13 2023-08-11 北京原点数安科技有限公司 数据查询方法、装置、电子设备及存储介质
CN116578585B (zh) * 2023-07-13 2023-09-19 北京原点数安科技有限公司 数据查询方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN114357276A (zh) 2022-04-15
CN114357276B (zh) 2023-08-22

Similar Documents

Publication Publication Date Title
WO2023116086A1 (zh) 数据查询方法、装置、电子设备以及存储介质
US11681702B2 (en) Conversion of model views into relational models
US20210191934A1 (en) Target data obtaining method and apparatus
US9430523B2 (en) Entity-relationship model extensions using annotations
US11989176B2 (en) Data query method and apparatus, device, and computer-readable storage medium
US10733184B2 (en) Query planning and execution with source and sink operators
US8874547B2 (en) Parameter-sensitive plans
US20180165347A1 (en) Multi-dimensional analysis using named filters
US20110218978A1 (en) Operating on time sequences of data
US20180150514A1 (en) Query Execution Pipelining with Pump Operators
US20150074139A1 (en) Database Language Extended to Accommodate Entity-Relationship Models
CN109299133A (zh) 数据查询方法、计算机系统及非暂时性计算机可读介质
EP3832484A2 (en) Semantics processing method, semantics processing apparatus, electronic device, and medium
US11132363B2 (en) Distributed computing framework and distributed computing method
US11055353B2 (en) Typeahead and autocomplete for natural language queries
US11954084B2 (en) Method and apparatus for processing table, device, and storage medium
CN114356971A (zh) 数据处理方法、装置以及系统
CN116578585B (zh) 数据查询方法、装置、电子设备及存储介质
CN115827676A (zh) Sql子查询的执行方法、装置、终端设备以及介质
US10789249B2 (en) Optimal offset pushdown for multipart sorting
CN113064914A (zh) 数据提取方法及装置
CN113377808A (zh) Sql优化方法和装置
CN114237712B (zh) 指令执行方法、装置、电子设备及计算机存储介质
CN113220710B (zh) 数据查询方法、装置、电子设备以及存储介质
CN114090627B (zh) 一种数据查询方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22909404

Country of ref document: EP

Kind code of ref document: A1