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

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

Info

Publication number
CN112506931A
CN112506931A CN202011483123.7A CN202011483123A CN112506931A CN 112506931 A CN112506931 A CN 112506931A CN 202011483123 A CN202011483123 A CN 202011483123A CN 112506931 A CN112506931 A CN 112506931A
Authority
CN
China
Prior art keywords
data
query
standard
template
input data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011483123.7A
Other languages
Chinese (zh)
Inventor
李又明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202011483123.7A priority Critical patent/CN112506931A/en
Publication of CN112506931A publication Critical patent/CN112506931A/en
Pending legal-status Critical Current

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • 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
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to big data technology, and discloses a data query method, which comprises the following steps: judging the data type of the original input data, performing data verification on the original input data according to the data type to obtain standard input data, searching a corresponding original query template according to the standard input data, generating a standard query template by using the standard input data and the original query template, performing format conversion on the standard query template, generating a standard query statement by using a preset template engine and the standard query template after format conversion, searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result. In addition, the invention also relates to a block chain technology, and the query result can be stored in the node of the block chain. The invention also provides a data inquiry device, an electronic device and a computer readable storage medium. The invention can solve the problem of low data query efficiency.

Description

Data query method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of big data technologies, and in particular, to a data query method and apparatus, an electronic device, and a computer-readable storage medium.
Background
Under the background of big data, the data scale is sharply enlarged, the data forms are various, and the requirements on data application are increasingly improved, which brings huge challenges to the traditional database technology. In the prior art, the following method is adopted for data acquisition: 1. according to the traditional big data acquisition, a manual bill-drawing mode is adopted, corresponding query (SQL) sentences need to be edited for query and collection aiming at any data acquisition request, the labor cost is low, the efficiency is high, and the accuracy is low. 2. By using a specific data query engine (such as an elastic search data query engine), the technical threshold is high, which is not beneficial for non-technical personnel to perform data acquisition.
Disclosure of Invention
The invention provides a data query method, a data query device and a computer readable storage medium, and mainly aims to solve the problem of low data query efficiency.
In order to achieve the above object, the present invention provides a data query method, including:
acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data;
searching a corresponding original query template according to the data type of the standard input data, and generating a standard query template by using the standard input data and the original query template;
carrying out format conversion on the standard query template, and generating a standard query statement by using a preset template engine and the standard query template after format conversion;
and searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
Optionally, the determining the data type of the raw input data includes:
judging whether the data type of the original input data is known or not;
if the type of the original input data is an unknown data type, alarming;
and if the type of the original input data is a known data type, checking the original input data.
Optionally, the performing data verification on the original input data according to the data type to obtain standard input data includes:
carrying out format verification on the original input data with known data types;
if the format check fails, alarming;
if the format verification is successful, the validity of the data with the successful format verification is verified by using a preset verification method, and the data with the successful validity verification is determined as the standard input data.
Optionally, the searching for the corresponding original query template according to the data type of the standard input data includes:
extracting key words in the standard input data by using a preset language processing algorithm;
and matching corresponding original query templates in a preset original query template set according to the keywords.
Optionally, the generating a standard query template by using the standard input data and the original query template includes:
acquiring a preset replacement script;
replacing the fixed parameters in the original query template by using the standard input data as query conditions by using the replacement script to obtain query statements containing the query conditions;
and summarizing the query sentences to obtain the standard query template.
Optionally, the format conversion of the standard query template, and the generation of the standard query statement by using a preset template engine and the standard query template after format conversion include:
converting the standard query template into a file with a preset format to obtain a standard format template;
and generating the standard query statement by using the standard query condition in the standard format template and a preset template engine.
Optionally, the searching data in a preset database by using the standard query statement includes:
generating an intermediate table field using the standard query statement;
inquiring all intermediate tables in the database according to the intermediate table fields to obtain a result intermediate table consistent with the intermediate table fields;
and searching data in the result intermediate table by using the standard query condition in the standard query statement and the intermediate table field.
In order to solve the above problem, the present invention also provides a data query apparatus, including:
the data verification module is used for acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data;
the template generating module is used for searching a corresponding original query template according to the data type of the standard input data and generating a standard query template by using the standard input data and the original query template;
the format conversion module is used for carrying out format conversion on the standard query template and generating a standard query statement by utilizing a preset template engine and the standard query template after format conversion;
and the data query module is used for searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one instruction; and
and the processor executes the instructions stored in the memory to realize the data query method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, which stores at least one instruction, where the at least one instruction is executed by a processor in an electronic device to implement the data query method described above.
According to the method and the device, the data type of the original input data is judged, and the data verification is carried out on the original input data according to the data type, so that the accuracy of the original input data can be ensured, the input of wrong data by a user is avoided, and the data query accuracy and efficiency are improved. And the standard input data and the original query template are used for generating a standard query template, a preset template engine and the standard query template after format conversion are used for generating a standard query statement, a user does not need to write the query statement, the data query efficiency is greatly improved, and meanwhile, the technical threshold of business personnel is reduced due to the fact that the template is used for querying. Therefore, the data query method, the data query device, the electronic equipment and the computer readable storage medium provided by the invention can solve the problem of low data query efficiency.
Drawings
Fig. 1 is a schematic flow chart of a data query method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart showing a detailed implementation of one of the steps in FIG. 1;
FIG. 3 is a schematic flow chart showing another step of FIG. 1;
FIG. 4 is a schematic flow chart showing another step of FIG. 1;
FIG. 5 is a schematic flow chart showing another step in FIG. 1;
FIG. 6 is a functional block diagram of a data query device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device for implementing the data query method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a data query method. The execution subject of the data query method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the data query method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart of a data query method according to an embodiment of the present invention. In this embodiment, the data query method includes:
s1, acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data.
In at least one embodiment of the invention, the raw input data may be query information input by a user. The data types may be: name, identification card number, mobile phone number, etc. For example, in the financial field, the query information may include: user name, user identification number, user mobile phone number and the like.
In the embodiment of the present invention, referring to fig. 2, the determining the data type of the original input data includes:
s10, judging whether the data type of the original input data is known or not;
if the type of the original input data is an unknown data type, executing S11 and giving an alarm;
if the type of the original input data is a known data type, S12 is executed to check the original input data.
Further, the performing data verification on the original input data according to the data type to obtain standard input data includes:
carrying out format verification on the original input data with known data types;
if the format check fails, alarming;
if the format verification is successful, the validity of the data with the successful format verification is verified by using a preset verification method, and the data with the successful validity verification is determined as the standard input data.
In the embodiment of the invention, taking the verification of the user identification number as an example, the format of the user identification number is verified firstly, and then whether the user identification number is valid is verified according to a preset verification method: 1. multiplying and adding the first 17 bits of the ID card by different coefficients respectively, (for example, the coefficients from the first to the seventeenth bits are 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 respectively); 2. dividing the result of the addition by 11 to obtain a remainder (the remainder only may be 11 digits of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and the last digit of the identification card corresponding to the 11 digits is 1, 0, X, 9, 8, 7, 6, 5, 4, 3, 2); 3. and judging whether the ID card number is legal or not by judging whether the remainder corresponds to the ID card number. For example, the id number is 34052419800101001X, 3 × 7+4 × 9+0 × 10+ 5+ … +1 × 2 is calculated as 189, 189 is divided by 11 to obtain the result 17 and 2, and the number corresponding to 2 is X according to the remainder correspondence, and it is determined as legal data.
Furthermore, in the embodiment of the invention, by carrying out data verification on the data input by the user, the warning can be carried out on the format error data or the illegal data, and the condition that no data is output after waiting because the user inputs the error data is avoided.
S2, searching a corresponding original query template according to the data type of the standard input data, and generating a standard query template by using the standard input data and the original query template.
Preferably, referring to fig. 3, the searching for the corresponding original query template according to the data type of the standard input data includes:
s20, extracting keywords in the standard input data by using a preset language processing algorithm;
and S21, matching the corresponding original query template in the preset original query template set according to the keywords.
The original query template set in the embodiment of the invention comprises: a user information query template, a financial information query template, a transaction information query template, a derived data template, and the like.
Further, the extracting the keywords in the standard input data by using a preset language processing algorithm includes:
performing word segmentation processing on the standard input data, and removing stop words to obtain word segmentation results;
and selecting one or more keywords from the word segmentation result.
The preset language processing algorithm in the embodiment of the invention can be a TextRank which is disclosed at present, a keyword extraction algorithm based on semantics and the like. For example, in the financial field, the keywords "id card", "mobile phone number", and the like in the standard input data are extracted and matched with the corresponding user information query template.
In detail, the generating a standard query template by using the standard input data and the original query template includes:
acquiring a preset replacement script;
replacing the fixed parameters in the original query template by using the standard input data as query conditions by using the replacement script to obtain query statements containing the query conditions;
and summarizing the query sentences to obtain the standard query template.
In the embodiment of the present invention, the replacement script may be a Shell script, and the replacement script is configured to write the standard input data as a parameter into a corresponding original query template to obtain the standard query template, where the standard query template includes a query condition.
Furthermore, in the embodiment of the invention, different query templates can be formulated according to user input data of different data types, so that the application scenarios are richer.
And S3, converting the format of the standard query template, and generating a standard query statement by using a preset template engine and the standard query template after format conversion.
In the embodiment of the present invention, referring to fig. 4, the S3 includes:
s30, converting the standard query template into a file with a preset format to obtain a standard format template;
and S31, generating the standard query statement by using the standard query condition in the standard format template and a preset template engine.
In the embodiment of the invention, the conversion into the file with the preset format refers to the conversion of the standard query template into the TXT format, and the TXT format is a text format and has the advantages of small volume, simple storage and the like. The standard query statement can be Structured Query Language (SQL) which is disclosed at present, the SQL is the most widely used language in data processing, a user is allowed to concisely and briefly declare required business logic, the SQL belongs to a set language, and only the requirement needs to be clearly expressed without knowing a specific method; SQL can be optimized, various query optimizers are built in, and the various query optimizers can translate an optimal execution plan for SQL. The template engine may be a JavaScript template engine, and the JavaScript template engine may generate an SQL statement from a file in a specific format.
Furthermore, the template engine can be used for rapidly processing the standard query template, so that the data query speed is improved.
And S4, searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
Preferably, referring to fig. 5, the searching data in the preset database by using the standard query statement includes:
s40, generating an intermediate table field by using the standard query statement;
s41, inquiring all intermediate tables in the database according to the intermediate table fields to obtain a result intermediate table consistent with the intermediate table fields;
and S42, searching data in the result intermediate table by using the standard query condition in the standard query statement and the intermediate table field.
The preset database can be a Mysql database, an Oracle database, a Sqlserver database and the like. The intermediate table is used to store data in the database. The result intermediate table refers to an intermediate table containing the intermediate table fields.
In detail, the compressing the data to obtain the query result includes:
reading a preset export data template according to a preset interface;
generating a derived statement of the derived data template with the template engine;
and writing the data into a preset document according to the export statement, and compressing and storing the document to obtain the query result.
The preset interface may be a Java database connection (Java Data Base Connectivity, Java database connection), the Java database connection is a Java API for executing SQL statements, and may provide unified access to a plurality of relational databases, and the Java database connection is composed of a group of classes and interfaces written in Java language. The document may be an EXCEL document.
Furthermore, the invention implements data query in a template mode, and can improve the efficiency of data query.
According to the method and the device, the data type of the original input data is judged, and the data verification is carried out on the original input data according to the data type, so that the accuracy of the original input data can be ensured, the input of wrong data by a user is avoided, and the data query accuracy and efficiency are improved. And the standard input data and the original query template are used for generating a standard query template, a preset template engine and the standard query template after format conversion are used for generating a standard query statement, a user does not need to write the query statement, the data query efficiency is greatly improved, and meanwhile, the technical threshold of business personnel is reduced due to the fact that the template is used for querying. Therefore, the embodiment provided by the invention can solve the problem of low data query efficiency.
Fig. 6 is a functional block diagram of a data query apparatus according to an embodiment of the present invention.
The data query apparatus 100 according to the present invention may be installed in an electronic device. According to the implemented functions, the data query apparatus 100 may include a data verification module 101, a template generation module 102, a format conversion module 103, and a data query module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the data verification module 101 is configured to obtain original input data, determine a data type of the original input data, and perform data verification on the original input data according to the data type to obtain standard input data.
In at least one embodiment of the invention, the raw input data may be query information input by a user. The data types may be: name, identification card number, mobile phone number, etc. For example, in the financial field, the query information may include: user name, user identification number, user mobile phone number and the like.
In this embodiment of the present invention, the data verification module 101 determines the data type of the original input data through the following operations:
judging whether the data type of the original input data is known or not;
if the type of the original input data is an unknown data type, alarming;
and if the type of the original input data is a known data type, checking the original input data.
Further, the data verification module 101 performs data verification on the original input data through the following operations to obtain standard input data:
carrying out format verification on the original input data with known data types;
if the format check fails, alarming;
if the format verification is successful, the validity of the data with the successful format verification is verified by using a preset verification method, and the data with the successful validity verification is determined as the standard input data.
In the embodiment of the invention, taking the verification of the user identification number as an example, the format of the user identification number is verified firstly, and then whether the user identification number is valid is verified according to a preset verification method: 1. multiplying and adding the first 17 bits of the ID card by different coefficients respectively, (for example, the coefficients from the first to the seventeenth bits are 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 respectively); 2. dividing the result of the addition by 11 to obtain a remainder (the remainder only may be 11 digits of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and the last digit of the identification card corresponding to the 11 digits is 1, 0, X, 9, 8, 7, 6, 5, 4, 3, 2); 3. and judging whether the ID card number is legal or not by judging whether the remainder corresponds to the ID card number. For example, the id number is 34052419800101001X, 3 × 7+4 × 9+0 × 10+ 5+ … +1 × 2 is calculated as 189, 189 is divided by 11 to obtain the result 17 and 2, and the number corresponding to 2 is X according to the remainder correspondence, and it is determined as legal data.
Furthermore, in the embodiment of the invention, by carrying out data verification on the data input by the user, the warning can be carried out on the format error data or the illegal data, and the condition that no data is output after waiting because the user inputs the error data is avoided.
The template generating module 102 is configured to search for a corresponding original query template according to the data type of the standard input data, and generate a standard query template by using the standard input data and the original query template.
Preferably, the template generating module 102 searches for the corresponding original query template by:
extracting key words in the standard input data by using a preset language processing algorithm;
and matching corresponding original query templates in a preset original query template set according to the keywords.
The original query template set in the embodiment of the invention comprises: a user information query template, a financial information query template, a transaction information query template, a derived data template, and the like.
Further, the template generating module 102 extracts the keywords in the standard input data by:
performing word segmentation processing on the standard input data, and removing stop words to obtain word segmentation results;
and selecting one or more keywords from the word segmentation result.
The preset language processing algorithm in the embodiment of the invention can be a TextRank which is disclosed at present, a keyword extraction algorithm based on semantics and the like. For example, in the financial field, the keywords "id card", "mobile phone number", and the like in the standard input data are extracted and matched with the corresponding user information query template.
In detail, the template generation module 102 generates a standard query template by:
acquiring a preset replacement script;
replacing the fixed parameters in the original query template by using the standard input data as query conditions by using the replacement script to obtain query statements containing the query conditions;
and summarizing the query sentences to obtain the standard query template.
In the embodiment of the present invention, the replacement script may be a Shell script, and the replacement script is configured to write the standard input data as a parameter into a corresponding original query template to obtain the standard query template, where the standard query template includes a query condition.
Furthermore, in the embodiment of the invention, different query templates can be formulated according to user input data of different data types, so that the application scenarios are richer.
The format conversion module 103 is configured to perform format conversion on the standard query template, and generate a standard query statement by using a preset template engine and the standard query template after format conversion.
In this embodiment of the present invention, the format conversion module 103 generates a standard query statement by:
converting the standard query template into a file with a preset format to obtain a standard format template;
and generating the standard query statement by using the standard query condition in the standard format template and a preset template engine.
In the embodiment of the invention, the conversion into the file with the preset format refers to the conversion of the standard query template into the TXT format, and the TXT format is a text format and has the advantages of small volume, simple storage and the like. The standard query statement can be Structured Query Language (SQL) which is disclosed at present, the SQL is the most widely used language in data processing, a user is allowed to concisely and briefly declare required business logic, the SQL belongs to a set language, and only the requirement needs to be clearly expressed without knowing a specific method; SQL can be optimized, various query optimizers are built in, and the various query optimizers can translate an optimal execution plan for SQL. The template engine may be a JavaScript template engine, and the JavaScript template engine may generate an SQL statement from a file in a specific format.
Furthermore, the template engine can be used for rapidly processing the standard query template, so that the data query speed is improved.
The data query module 104 is configured to search data in a preset database by using the standard query statement, and compress the data to obtain a query result.
Preferably, the data query module 104 searches for data by:
generating an intermediate table field using the standard query statement;
inquiring all intermediate tables in the database according to the intermediate table fields to obtain a result intermediate table consistent with the intermediate table fields;
and searching data in the result intermediate table by using the standard query condition in the standard query statement and the intermediate table field.
The preset database can be a Mysql database, an Oracle database, a Sqlserver database and the like. The intermediate table is used to store data in the database. The result intermediate table refers to an intermediate table containing the intermediate table fields.
In detail, the data query module 104 performs compression processing on the data to obtain a query result by:
reading a preset export data template according to a preset interface;
generating a derived statement of the derived data template with the template engine;
and writing the data into a preset document according to the export statement, and compressing and storing the document to obtain the query result.
The preset interface may be a Java database connection (Java Data Base Connectivity, Java database connection), the Java database connection is a Java API for executing SQL statements, and may provide unified access to a plurality of relational databases, and the Java database connection is composed of a group of classes and interfaces written in Java language. The document may be an EXCEL document.
Furthermore, the invention implements data query in a template mode, and can improve the efficiency of data query.
Fig. 7 is a schematic structural diagram of an electronic device implementing a data query method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a data query program 12, stored in the memory 11 and operable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of the data inquiry program 12, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., data query programs, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 7 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 7 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The data query program 12 stored in the memory 11 of the electronic device 1 is a combination of instructions, which when executed in the processor 10, can implement:
acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data;
searching a corresponding original query template according to the data type of the standard input data, and generating a standard query template by using the standard input data and the original query template;
carrying out format conversion on the standard query template, and generating a standard query statement by using a preset template engine and the standard query template after format conversion;
and searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiments corresponding to fig. 1 to fig. 5, which is not repeated herein.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data;
searching a corresponding original query template according to the data type of the standard input data, and generating a standard query template by using the standard input data and the original query template;
carrying out format conversion on the standard query template, and generating a standard query statement by using a preset template engine and the standard query template after format conversion;
and searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for data query, the method comprising:
acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data;
searching a corresponding original query template according to the data type of the standard input data, and generating a standard query template by using the standard input data and the original query template;
carrying out format conversion on the standard query template, and generating a standard query statement by using a preset template engine and the standard query template after format conversion;
and searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
2. The data query method of claim 1, wherein said determining a data type of said raw input data comprises:
judging whether the data type of the original input data is known or not;
if the type of the original input data is an unknown data type, alarming;
and if the type of the original input data is a known data type, checking the original input data.
3. The data query method of claim 2, wherein the performing data verification on the original input data according to the data type to obtain standard input data comprises:
carrying out format verification on the original input data with known data types;
if the format check fails, alarming;
if the format verification is successful, the validity of the data with the successful format verification is verified by using a preset verification method, and the data with the successful validity verification is determined as the standard input data.
4. The data query method of claim 1, wherein said searching for a corresponding original query template according to the data type of the standard input data comprises:
extracting key words in the standard input data by using a preset language processing algorithm;
and matching corresponding original query templates in a preset original query template set according to the keywords.
5. The data query method of claim 1, wherein generating a standard query template using the standard input data and the original query template comprises:
acquiring a preset replacement script;
replacing the fixed parameters in the original query template by using the standard input data as query conditions by using the replacement script to obtain query statements containing the query conditions;
and summarizing the query sentences to obtain the standard query template.
6. The data query method of claim 1, wherein converting the format of the standard query template, and generating a standard query statement using a preset template engine and the standard query template after converting the format, comprises:
converting the standard query template into a file with a preset format to obtain a standard format template;
and generating the standard query statement by using the standard query condition in the standard format template and a preset template engine.
7. The data query method according to any one of claims 1 to 6, wherein the searching for data in a preset database by using the standard query statement comprises:
generating an intermediate table field using the standard query statement;
inquiring all intermediate tables in the database according to the intermediate table fields to obtain a result intermediate table consistent with the intermediate table fields;
and searching data in the result intermediate table by using the standard query condition in the standard query statement and the intermediate table field.
8. A data query apparatus, characterized in that the apparatus comprises:
the data verification module is used for acquiring original input data, judging the data type of the original input data, and performing data verification on the original input data according to the data type to obtain standard input data;
the template generating module is used for searching a corresponding original query template according to the data type of the standard input data and generating a standard query template by using the standard input data and the original query template;
the format conversion module is used for carrying out format conversion on the standard query template and generating a standard query statement by utilizing a preset template engine and the standard query template after format conversion;
and the data query module is used for searching data in a preset database by using the standard query statement, and compressing the data to obtain a query result.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a data query method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out a data query method according to any one of claims 1 to 7.
CN202011483123.7A 2020-12-15 2020-12-15 Data query method and device, electronic equipment and storage medium Pending CN112506931A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011483123.7A CN112506931A (en) 2020-12-15 2020-12-15 Data query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011483123.7A CN112506931A (en) 2020-12-15 2020-12-15 Data query method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112506931A true CN112506931A (en) 2021-03-16

Family

ID=74972463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011483123.7A Pending CN112506931A (en) 2020-12-15 2020-12-15 Data query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112506931A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114721748A (en) * 2022-04-11 2022-07-08 广州宇中网络科技有限公司 Data query method, system, equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160034578A1 (en) * 2014-07-31 2016-02-04 Palantir Technologies, Inc. Querying medical claims data
CN109241095A (en) * 2018-07-13 2019-01-18 网宿科技股份有限公司 A kind of method for quickly querying, terminal and can storage medium
CN110209705A (en) * 2019-04-25 2019-09-06 深圳壹账通智能科技有限公司 Data query method, apparatus, computer equipment, computer storage medium
CN110674179A (en) * 2019-09-24 2020-01-10 政采云有限公司 Query interface generation method, device and medium
CN110888876A (en) * 2019-10-31 2020-03-17 平安科技(深圳)有限公司 Method and device for generating database script, storage medium and computer equipment
CN111221842A (en) * 2018-11-27 2020-06-02 北京奇虎科技有限公司 Big data processing system and method
CN111414377A (en) * 2020-03-05 2020-07-14 微民保险代理有限公司 Method and device for processing structured query statement and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160034578A1 (en) * 2014-07-31 2016-02-04 Palantir Technologies, Inc. Querying medical claims data
CN109241095A (en) * 2018-07-13 2019-01-18 网宿科技股份有限公司 A kind of method for quickly querying, terminal and can storage medium
CN111221842A (en) * 2018-11-27 2020-06-02 北京奇虎科技有限公司 Big data processing system and method
CN110209705A (en) * 2019-04-25 2019-09-06 深圳壹账通智能科技有限公司 Data query method, apparatus, computer equipment, computer storage medium
CN110674179A (en) * 2019-09-24 2020-01-10 政采云有限公司 Query interface generation method, device and medium
CN110888876A (en) * 2019-10-31 2020-03-17 平安科技(深圳)有限公司 Method and device for generating database script, storage medium and computer equipment
CN111414377A (en) * 2020-03-05 2020-07-14 微民保险代理有限公司 Method and device for processing structured query statement and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114721748A (en) * 2022-04-11 2022-07-08 广州宇中网络科技有限公司 Data query method, system, equipment and readable storage medium
CN114721748B (en) * 2022-04-11 2024-02-27 广州宇中网络科技有限公司 Data query method, system, device and readable storage medium

Similar Documents

Publication Publication Date Title
CN112541338A (en) Similar text matching method and device, electronic equipment and computer storage medium
CN112052242A (en) Data query method and device, electronic equipment and storage medium
CN112115152B (en) Data increment updating and inquiring method and device, electronic equipment and storage medium
CN114979120B (en) Data uploading method, device, equipment and storage medium
CN112231417A (en) Data classification method and device, electronic equipment and storage medium
CN112115143A (en) Automatic data updating and synchronizing method and device, electronic equipment and storage medium
CN113672781A (en) Data query method and device, electronic equipment and storage medium
CN114610747A (en) Data query method, device, equipment and storage medium
CN113434674A (en) Data analysis method and device, electronic equipment and readable storage medium
CN111651453A (en) User historical behavior query method and device, electronic equipment and storage medium
CN112733551A (en) Text analysis method and device, electronic equipment and readable storage medium
CN112949278A (en) Data checking method and device, electronic equipment and readable storage medium
CN112667775A (en) Keyword prompt-based retrieval method and device, electronic equipment and storage medium
CN113468175A (en) Data compression method and device, electronic equipment and storage medium
CN112464619B (en) Big data processing method, device and equipment and computer readable storage medium
CN113434542A (en) Data relation identification method and device, electronic equipment and storage medium
CN113282854A (en) Data request response method and device, electronic equipment and storage medium
CN112506931A (en) Data query method and device, electronic equipment and storage medium
CN111538768A (en) Data query method and device based on N-element model, electronic equipment and medium
CN115114297A (en) Data lightweight storage and search method and device, electronic equipment and storage medium
CN114840388A (en) Data monitoring method and device, electronic equipment and storage medium
CN114610854A (en) Intelligent question and answer method, device, equipment and storage medium
CN113407657A (en) Data query method, device, equipment and storage medium based on single-level database
CN113342283A (en) User position information storage method and device, electronic equipment and readable storage medium
CN111859452A (en) Page information checking method, device and equipment and computer readable storage medium

Legal Events

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