CN110083650B - Metadata self-discovery-based automatic generation method for data query interface - Google Patents

Metadata self-discovery-based automatic generation method for data query interface Download PDF

Info

Publication number
CN110083650B
CN110083650B CN201910337144.9A CN201910337144A CN110083650B CN 110083650 B CN110083650 B CN 110083650B CN 201910337144 A CN201910337144 A CN 201910337144A CN 110083650 B CN110083650 B CN 110083650B
Authority
CN
China
Prior art keywords
data
parameters
query
database
user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910337144.9A
Other languages
Chinese (zh)
Other versions
CN110083650A (en
Inventor
陈昊
王鹏
于会游
姜玉峰
滕姿
李栋
杜浩
唐丽娜
饶定远
陈燕秋
闵圣捷
杨飞
丁晓宇
董一舟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cetc Kehuayun Information Technology Co ltd
Zhongdianke Jiaxing Novel Wisdom City Technology Development Co ltd
Original Assignee
Cetc Kehuayun Information Technology Co ltd
Zhongdianke Jiaxing Novel Wisdom City Technology Development 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 Cetc Kehuayun Information Technology Co ltd, Zhongdianke Jiaxing Novel Wisdom City Technology Development Co ltd filed Critical Cetc Kehuayun Information Technology Co ltd
Priority to CN201910337144.9A priority Critical patent/CN110083650B/en
Publication of CN110083650A publication Critical patent/CN110083650A/en
Application granted granted Critical
Publication of CN110083650B publication Critical patent/CN110083650B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • 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/24568Data stream processing; Continuous queries
    • 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/25Integrating or interfacing systems involving database management systems
    • 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/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • 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

Landscapes

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

Abstract

The automatic generation method of the data query interface based on metadata self-discovery comprises the following steps: the metadata management system automatically discovers the table and the table structure in the database and stores the table and the table structure in the service database; the user selects a data table, configures inquiry fields and parameters, and stores related parameters in a data inquiry system; the system generates an SQL sentence template according to the data query parameter list selected by the user, and the template can accept parameters and operators appointed by the user as parameters; the system generates a corresponding URL address and adds a route forwarding rule and the API mapping; when the interface is used for inquiring data, the application calls the API through the appointed URL; checking the legitimacy of the input parameters according to the parameter list corresponding to the URL; if the parameters are legal, generating SQL sentences by using the parameters to the stored SQL sentence templates; and calling the database to inquire the data, serializing the result data according to the JSON format, and returning the data in a data stream mode.

Description

Metadata self-discovery-based automatic generation method for data query interface
Technical Field
The invention belongs to the technical field of databases, and particularly relates to a metadata self-discovery-based automatic generation method and system for a data query interface.
Background
Along with the continuous development of informatization construction, data are continuously increased, and the demand for data query is more and more increased. The prior art can generate a query interface by writing sql statements according to a fixed data structure. However, when the data structure is changed and different query parameters are needed, only the sql regeneration interface can be rewritten, so that great repeated development workload is brought.
Disclosure of Invention
The invention provides a metadata self-discovery-based automatic generation method and system for a data query interface, which are used for solving the problem that the existing data query interface needs to be repeatedly developed.
The embodiment of the invention discloses a data query interface automatic generation method based on metadata self-discovery, which comprises the following steps:
step 1, a metadata management system automatically discovers a table and a table structure in a database and stores the table and the table structure in a service database;
step 2, the user selects a data table, configures inquiry fields and parameters, and stores related parameters in a data inquiry system;
step 3, the system generates an SQL sentence template according to the data query parameter list selected by the user, and the template can accept parameters and operators designated by the user as parameters;
step 4, the system generates a corresponding URL address and adds a route forwarding rule and the API mapping;
step 5, repeating the steps 2 to 4, and repeatedly creating a plurality of APIs for different tables and different query parameters;
step 6, when the interface is used for inquiring data, the application calls the API through the appointed URL;
step 7, checking the legality of the input parameters according to the parameter list corresponding to the URL;
step 8, if the parameters are legal, using the parameters to generate SQL sentences with the saved SQL sentence templates;
and 9, calling database query data, serializing the result data according to the JSON format, and returning the data in a data stream mode.
The beneficial effects of the invention include:
the workload of manually and repeatedly writing SQL sentences is reduced;
adapting to the scene of data structure change, supporting the dynamic generation of a query interface;
the method adapts to the scene of the change of the query parameters and supports the dynamic assembly of sql statements.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. Several embodiments of the present invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 is a schematic diagram of an automatic generation system for a data query interface based on metadata self-discovery according to one embodiment of the present invention.
Description of the embodiments
According to one or more embodiments, as shown in fig. 1, a method for automatically generating a data query interface based on metadata self-discovery includes the following steps:
step 1, the metadata management system automatically discovers the table and the table structure in the database and stores the table and the table structure in the service database,
step 1.1, registering data source link information of data to be queried in a metadata management system;
step 1.2, the metadata management system automatically scans the database at fixed time by configuring a timing task;
step 1.3, automatically discovering a table and a table structure of a data source, wherein the table and the table structure comprise a table name, a field type and a field remark;
step 1.4 the data found in step 1.3 are saved in a business database,
step 2, the user selects the data table, configures the query field and the parameters, stores the related parameters in the data query system,
step 2.1, obtaining data table information stored by a metadata management system, and presenting the existing tables and table structures to a data user in a list form by the system;
step 2.2, the user selects a table which needs to automatically generate a data query API, and selects a field and a parameter rule which run in the API for transmitting query parameters;
the step 2.3 system saves the relevant parameters to a database,
step 3, the system generates an SQL sentence template according to the data query parameter list selected by the user, and the template can accept parameters and operators appointed by the user as parameters;
step 4, the system generates a corresponding URL address and adds a route forwarding rule and the API mapping;
step 5, repeating the steps 2 to 4, and repeatedly creating a plurality of APIs for different tables and different query parameters;
step 6, when the interface is used for inquiring data, the application calls the API through the appointed URL;
step 7, the system checks the legality of the input parameters according to the parameter list corresponding to the URL;
step 8, if the parameters are legal, generating SQL sentences by using the parameters on the stored SQL sentence templates;
and 9, invoking database query data, serializing the result data according to the JSON format, and returning the data in a data stream mode.
The embodiment provides a method for automatically generating a query interface without re-writing SQL when the data structure is changed and different query parameters are needed.
In accordance with one or more embodiments, as shown in FIG. 1, a system for automatically generating a data query interface based on metadata self-discovery, the system comprising: a metadata management system, a data interface system and a data query system,
the functions of the metadata management system include:
registering a data source, regularly scanning the data source, acquiring all tables and fields of the acquired tables, and generating data source information, tables and table structures;
the functions of the data interface system include:
acquiring all tables according to the data source information, the tables and the table structures, acquiring the table structures through selecting the tables, generating SOL templates after configuring data query parameters, generating URLs, and establishing URL-API mapping by route forwarding;
the data query system functions include:
checking the validity of the URL, generating SQL sentences according to parameters if the parameter rule is valid, calling the database to inquire the data, and returning the data through the data stream.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices, or elements, or may be an electrical, mechanical, or other form of connection.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (1)

1. The automatic generation method of the data query interface based on the metadata self-discovery is characterized by comprising the following steps:
step 1, a metadata management system automatically discovers a table and a table structure in a database and stores the table and the table structure in a service database, wherein the step 1 comprises the following steps:
step 1.1, registering data source link information of data to be queried in a metadata management system;
step 1.2, the metadata management system automatically scans the database at regular time by configuring a timing task;
step 1.3, automatically discovering a table and a table structure of a data source, wherein the table and the table structure comprise a table name, a field type and a field remark;
step 1.4, the data found in the step 1.3 are stored in a service database;
step 2, a user selects a data table, configures query fields and parameters, and stores related parameters in a data query system, wherein the step 2 comprises:
step 2.1, acquiring data table information stored by a metadata management system, and presenting the existing tables and table structures to a data user in a list form by the system;
step 2.2, the user selects a table which needs to automatically generate a data query API, and selects a field and a parameter rule which run in the API for transmitting query parameters;
step 2.3, storing the relevant parameters into a database;
step 3, the system generates an SQL sentence template according to the data query parameter list selected by the user, and the template receives parameters and operators designated by the user as parameters;
step 4, the system generates a corresponding URL address and adds a route forwarding rule and the API mapping;
step 5, repeating the steps 2 to 4, and repeatedly creating a plurality of APIs for different tables and different query parameters;
step 6, when the interface is used for inquiring data, the application calls the API through the appointed URL;
step 7, checking the legality of the input parameters according to the parameter list corresponding to the URL;
step 8, if the parameters are legal, using the parameters to generate SQL sentences with the saved SQL sentence templates;
and 9, calling database query data, serializing the result data according to the JSON format, and returning the data in a data stream mode.
CN201910337144.9A 2019-04-25 2019-04-25 Metadata self-discovery-based automatic generation method for data query interface Active CN110083650B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910337144.9A CN110083650B (en) 2019-04-25 2019-04-25 Metadata self-discovery-based automatic generation method for data query interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910337144.9A CN110083650B (en) 2019-04-25 2019-04-25 Metadata self-discovery-based automatic generation method for data query interface

Publications (2)

Publication Number Publication Date
CN110083650A CN110083650A (en) 2019-08-02
CN110083650B true CN110083650B (en) 2023-06-30

Family

ID=67416641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910337144.9A Active CN110083650B (en) 2019-04-25 2019-04-25 Metadata self-discovery-based automatic generation method for data query interface

Country Status (1)

Country Link
CN (1) CN110083650B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112734349A (en) * 2019-10-14 2021-04-30 珠海格力电器股份有限公司 Interface generation method, data calling method, device and electronic equipment
KR102171436B1 (en) * 2019-12-16 2020-10-29 주식회사 레몬헬스케어 Cloud-based API metadata management method and system for hospital data standardization
CN111198772A (en) * 2019-12-23 2020-05-26 中思博安科技(北京)有限公司 Method and system for generating application program interface API
CN111291074B (en) * 2020-02-27 2023-03-28 北京思特奇信息技术股份有限公司 Database query method, system, medium and device
CN112131294A (en) * 2020-09-22 2020-12-25 城云科技(中国)有限公司 Method, system and device for quickly generating interface
CN112558950A (en) * 2020-12-21 2021-03-26 北京搜房科技发展有限公司 System interface generation method and device
CN112667663A (en) * 2020-12-28 2021-04-16 北京明略软件***有限公司 Data query method and system
CN112799659A (en) * 2021-01-12 2021-05-14 杨飞 Method, device and terminal for automatically generating data interface without programming
CN112764744B (en) * 2021-01-25 2023-04-14 芝麻云信(武汉)科技有限公司 Interface service design method for ERP system
CN113419719B (en) * 2021-06-29 2023-10-13 北京仁科互动网络技术有限公司 Interface use case generation method and system based on business scene
CN114004211B (en) * 2021-12-30 2022-09-02 太平金融科技服务(上海)有限公司深圳分公司 Document template generation method, processing method, device, computer equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7680781B1 (en) * 2005-03-04 2010-03-16 Teradata Us, Inc. Automatic search query generation and results set management
CN103093000A (en) * 2013-02-25 2013-05-08 用友软件股份有限公司 Database query modeling system and database query modeling method
CN106909610A (en) * 2017-01-10 2017-06-30 中电科华云信息技术有限公司 Visualization based on browser pulls the method and system of inquiry data
CN107257973A (en) * 2015-02-18 2017-10-17 起元技术有限责任公司 The data source inquired about on network

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7310637B2 (en) * 2004-05-05 2007-12-18 International Business Machines Corporation Dynamic database access via standard query language and abstraction technology
CN100568244C (en) * 2007-10-31 2009-12-09 金蝶软件(中国)有限公司 A kind of method and system of data base dynamic inquiry
US9009137B2 (en) * 2010-03-12 2015-04-14 Microsoft Technology Licensing, Llc Query model over information as a networked service
CN102521274A (en) * 2011-11-24 2012-06-27 上海明想电子科技有限公司 Ibatis-based SQL script dynamic loading method
CN104572896A (en) * 2014-12-25 2015-04-29 福建亿榕信息技术有限公司 Method and system for automatically governing data of relational database
US10185726B2 (en) * 2016-08-26 2019-01-22 BlueTalon, Inc. Access control for nested data fields
US10380139B2 (en) * 2016-11-15 2019-08-13 Spirent Communications, Inc. SQL interceptor for use with third party data analytics packages
CN107679071B (en) * 2017-08-22 2020-12-18 中国科学院计算机网络信息中心 Relational database-oriented general data service customized packaging method
CN108334547B (en) * 2017-12-27 2020-10-30 中电科华云信息技术有限公司 Data sharing exchange system and method based on big data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7680781B1 (en) * 2005-03-04 2010-03-16 Teradata Us, Inc. Automatic search query generation and results set management
CN103093000A (en) * 2013-02-25 2013-05-08 用友软件股份有限公司 Database query modeling system and database query modeling method
CN107257973A (en) * 2015-02-18 2017-10-17 起元技术有限责任公司 The data source inquired about on network
CN106909610A (en) * 2017-01-10 2017-06-30 中电科华云信息技术有限公司 Visualization based on browser pulls the method and system of inquiry data

Also Published As

Publication number Publication date
CN110083650A (en) 2019-08-02

Similar Documents

Publication Publication Date Title
CN110083650B (en) Metadata self-discovery-based automatic generation method for data query interface
CN109840429B (en) Intelligent contract deployment and calling method and device
CN107977396B (en) Method and device for updating data table of KeyValue database
CN105472045A (en) Database migration method and database migration device
CN101557427A (en) Method for providing diffluent information and realizing the diffluence of clients, system and server thereof
CN105701122A (en) Log collection method, apparatus and system
EP3217632B1 (en) Oid configuration, parsing method, client, node, database and storage medium
CN111818175B (en) Enterprise service bus configuration file generation method, device, equipment and storage medium
CN103647696A (en) Message reply method and system under micro message development mode
CN107844488B (en) Data query method and device
CN111381820A (en) Method and device for automatically generating API based on GUI
CN105868196A (en) Method for generating industrial data report in server
CN101997732A (en) Method, device and system for inquiring service
KR20110106382A (en) Extensibility for web based diagram visualization
CN111414361A (en) Label data storage method, device, equipment and readable storage medium
CN111581565B (en) Page style configuration method, system, medium and equipment
US8843587B2 (en) Retrieving availability information from published calendars
CN110888672B (en) Expression engine implementation method and system based on metadata architecture
CN104267921A (en) Page display control method and server
CN111090803A (en) Data processing method and device, electronic equipment and storage medium
CN111198678A (en) Method and device for generating GraphQL front-end operation interface
CN111797334B (en) Website access method and device, electronic equipment and storage medium
CN105205060A (en) Method and device for generating word document database dictionary
US10448124B2 (en) Method and system for issuing media information
CN112579877A (en) Information source system control method, device, storage medium and equipment

Legal Events

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