CN113448942A - Database access method, device, equipment and storage medium - Google Patents

Database access method, device, equipment and storage medium Download PDF

Info

Publication number
CN113448942A
CN113448942A CN202010235296.0A CN202010235296A CN113448942A CN 113448942 A CN113448942 A CN 113448942A CN 202010235296 A CN202010235296 A CN 202010235296A CN 113448942 A CN113448942 A CN 113448942A
Authority
CN
China
Prior art keywords
database
access request
data
access
language format
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.)
Granted
Application number
CN202010235296.0A
Other languages
Chinese (zh)
Other versions
CN113448942B (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010235296.0A priority Critical patent/CN113448942B/en
Publication of CN113448942A publication Critical patent/CN113448942A/en
Application granted granted Critical
Publication of CN113448942B publication Critical patent/CN113448942B/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/21Design, administration or maintenance of databases
    • 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
    • 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/23Updating
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Abstract

The embodiment of the application provides a database access method, a database access device and a storage medium. In the embodiment of the application, another database kernel can be realized on the basis of the kernel of the existing database, the protocol processing module is arranged, and the access request with the language format supported by the other database is converted into the access request with the language format supported by the existing database, so that the database kernel can access the storage space of the database according to the access request with the language format supported by the existing database, and the access to the database is realized. When the database is developed, the kernel of the database which is developed at present can be used for developing, development workload can be reduced without starting from zero, and the database development efficiency is improved.

Description

Database access method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a database access method, apparatus, device, and storage medium.
Background
In the information age, the application and research of information data have become a trend, and databases are widely applied to data storage, management, maintenance and query based on their advantages.
A database is a computer software system that stores and manages data in a data structure. In the prior art, to develop a new database, the development is often required from scratch, the development workload is large, and the development efficiency is low.
Disclosure of Invention
Aspects of the present application provide a database access method, apparatus, device and storage medium, so as to improve the development efficiency of a database.
An embodiment of the present application further provides a database access method, including:
acquiring a first access request with a language format supported by a first database; converting the first access request into a second access request; the second access request has a target language format supported by an existing second database; and accessing a storage space of the first database according to a second access request with the target language format; the data in the storage space is stored in a data organization format supported by the second database; wherein the kernel of the first database is implemented on the basis of the kernel of the second database.
An embodiment of the present application further provides a database management apparatus, including: the system comprises a protocol processing module and a database kernel; the database kernel is realized on the basis of the kernel of the existing database;
the protocol processing module is used for converting the first access request with the language format supported by the database into a second access request; the second access request has a target language format supported by the existing database;
the database kernel is used for accessing the storage space of the database according to a second access request with the target language format; and the data in the storage space is stored in a data organization format supported by the existing database.
An embodiment of the present application further provides a database access apparatus, including: the system comprises an acquisition module, a processing module and an access module; wherein the content of the first and second substances,
the acquisition module is used for acquiring a first access request with a language format supported by a first database;
the processing module is used for converting the first access request into a second access request; the second access request has a target language format supported by a second database; wherein the kernel of the first database is implemented on the basis of the kernel of the second database;
the access module is used for accessing the storage space of the first database according to a second access request with the target language format; and the data in the storage space is stored in a data organization format supported by the second database.
An embodiment of the present application further provides a computer device, including: a memory and a processor; wherein the memory is used for storing a computer program;
the processor is coupled to the memory for executing the computer program for performing the steps of the above-described method.
Embodiments of the present application also provide a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method.
In the embodiment of the application, another database kernel can be realized on the basis of the kernel of the existing database, the protocol processing module is arranged, and the access request with the language format supported by the other database is converted into the access request with the language format supported by the existing database, so that the database kernel can access the storage space of the database according to the access request with the language format supported by the existing database, and the access to the database is realized. When the database is developed, the kernel of the database which is developed at present can be used for developing, development workload can be reduced without starting from zero, and the database development efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1a is a schematic structural diagram of a database management apparatus according to an embodiment of the present application;
FIG. 1b is an example of a language format supported by a database provided by an embodiment of the present application;
fig. 1c is a schematic structural diagram of another database management apparatus provided in an embodiment of the present application;
FIG. 1d is a diagram of a database supported data organization format according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a database access method according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a database access device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Aiming at the technical problem of large workload of database development in the prior art, in some embodiments of the present application, another database kernel can be implemented on the basis of the kernel of the existing database, and a protocol processing module is arranged to convert an access request in a language format supported by the other database into an access request in a language format supported by the existing database, so that the database kernel can access a storage space of the database according to the access request in the language format supported by the existing database, thereby implementing access to the database. When the database is developed, the kernel of the database which is developed at present can be used for developing, development workload can be reduced without starting from zero, and the database development efficiency is improved.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
It should be noted that: like reference numerals refer to like objects in the following figures and embodiments, and thus, once an object is defined in one figure or embodiment, further discussion thereof is not required in subsequent figures and embodiments.
Fig. 1a is a schematic structural diagram of a database management apparatus according to an embodiment of the present application. As shown in fig. 1a, the database management apparatus includes: a protocol processing module 11 and a database core 12. The database kernel 12 is implemented on the basis of the kernel of the existing database. Alternatively, the database kernel 12 may reuse the kernel of the existing database, or may make changes based on the kernel of the existing database. For example, data types and operators are added. Wherein, the implementation logic of the database kernel 12 and the recognized language format are the language format of the existing database.
In this embodiment, the type of the existing database may be the same as that of the database provided in this embodiment, or may be different from that of the database provided in this embodiment. In the embodiment of the present application, the type of the database is determined according to the data organization structure of the data provided to the user. For example, if the database is a document-type database, the data provided to the user is data organized in a document format. For another example, if the database is a relational database, the data provided to the user is data organized in a relational model, where a relational model is understood to store data in rows and columns, which may also be referred to as tables. For another example, if the database is a Key-value (KV) type database, the data provided to the database is data organized in a Key-value pair format.
In the embodiment of the present application, the types of the database and the existing database managed by the database management apparatus provided in the embodiment are not limited. For example, the existing database may be a relational database, and the database managed by the database management apparatus provided in the present embodiment may be a document type database, a KV database, a space-time database, or a full-text search database. The relational database can be a MySQL database and the like. For another example, the existing database is a document-type database, and the database managed by the database management apparatus provided in this embodiment is a relational database, KV database, space-time database, or full-text search database. For another example, the existing database is a key-value pair (KV) database, and the database managed by the database management device provided in this embodiment is a document type database, a relational database, a space-time database, or a full-text search database, etc.; but is not limited thereto. For another example, the existing database is an object-relational database, and the database managed by the database management apparatus provided in this embodiment may be a document-type database, a KV database, a space-time database, or a full-text search database. In short, the embodiment implements a new database kernel based on the already developed database kernel, which can reduce the development workload and help to improve the development efficiency.
In practical applications, a database management device needs to have the following functions: (1) creating a database and a data storage unit; (2) storing the data; (3) database access is supported. The embodiment of the application defines the database type by a data organization structure which is sensed by a user. Based on this, when accessing the database, the user submits the access request according to the language format supported by the user-perceivable database type, and therefore, the access request has the language format supported by the database managed by the database management apparatus provided in this embodiment. For example, the present embodiment provides the database managed by the database management apparatus as a document type database, such as the access statement shown on the left side of fig. 1b, the access request having a language format supported by the document type database. Where "db. createecollection (" person ")" in fig. 1b indicates that a document set named "person" is created. For a document type database, a document is a data model of the document type database, a document set (collection) refers to a set of a plurality of documents, and a plurality of document sets form one database. Plural means 2 or more.
Further, since the database kernel 12 is implemented by kernel logic of an existing database of a different type from the database provided in the present embodiment, the database kernel 12 cannot directly process an access request in a language format supported by the database provided in the present embodiment. Based on this, the protocol processing module 11 can convert the access request in the language format supported by the database provided in this embodiment into an access request in the target language format supported by the existing database. In this embodiment, for convenience of description and distinction, an access request having a language format supported by a database managed by the database management apparatus provided in this embodiment is defined as a first access request; and converting the first access request into an access request with a target language format supported by the existing database, and defining the access request as a second access request.
For example, if the database managed by the database management device is a document type database and the existing database is a relational database, the protocol processing module 11 can convert the language format supported by the document type database into the target language format supported by the relational database, as shown in fig. 1 b. Wherein, the left side of FIG. 1b represents the language format supported by the document type database, and the right side represents the target language format supported by the relational database. In the example of statements shown in FIG. 1b, the statement "db. createCollection (" person ")" in the language format supported by the documentary database on the left side of FIG. 1b indicates that a document set named "person" is created; accordingly, the statement is converted into a language format supported by the right-side relational database, which is "Create table person (b pbson); ", indicates that a table named" person "is created. The statement "db. person. create Index ({ name:1 })" in the language format supported by the document type database on the left side of FIG. 1b indicates that the Index "name: 1" is created in the document set "person"; accordingly, the statement "Create index name 1on person using BTREE (b- > 'name') in the language format supported by the right-side relational database; ", indicates that the creation creates the index" name:1 "in a table named" person ". The statement "db. person. insert ({ _ id:1001, name:" jack ", age: 18" }) "in the language format supported by the documentary database on the left side of FIG. 1b indicates that an information item to be identified as 1001, name jack, age 18 is inserted in the document set" person "; accordingly, the statement "Insert inter person values (pbson (_ id:1001, name:" jack ", age: 18")) in the language format supported by the relational database on the right side; ", indicates that an information item, which will be identified as 1001, with the name jack, age 18, is inserted in the table" person ". The statement "db. person. find ({ name:" jack "{, { name:1, age:1 })" in the language format supported by the documentary database on the left side of fig. 1b indicates that an information item with name jack is found in the documentary set "person"; accordingly, the statement "Select name, age from person pbson _ match (b, { name:" jack "}) in the language format supported by the relational database on the right; ", indicates an item of information named jack in the table" person ". FIG. 1b is a statement "db. person. update ({ name:: jack" }, { $ set: { age:20} }) "in the language format supported by the documentary database on the left side of the document set, indicating that the age of name jack is set to 20 in the document set" person "; accordingly, the statement "Update person set b { [ set: { age:20} }) where the language format supported by the relational database on the right side is pbson _ Update (b, { [ set: { age:20 })) where pbson _ match (b, { name:" jack "}); ", indicates that the age with the last name jack is set to 20 in the table" person ". The statement "db. person. remove ({ name:" jack "})" in the language format supported by the documentary database on the left side of fig. 1b indicates that an information item with name jack is deleted in the documentary set "person"; accordingly, the statement "Delete from pbson where pbson _ match (b, { name:" jack "}) in the language format supported by the relational database on the right; ", indicates that the information item named jack is deleted in the table" person ". Further, the database kernel 12 may access the storage space of the database according to the second access request having the target language format. In the present embodiment, the database kernel 12 is implemented on the basis of the kernel of the existing database. And the language format identified by the implementation logic of the database kernel is the language format of the existing database, and the identified data organization format is the data organization format of the existing database. Therefore, the data in the storage space of the database is stored in a data organization format supported by the existing database.
The existing databases are different in type, and the language format and the data organization format supported by the existing databases are also different. For example, the existing database is a relational database, and the language format supported by the existing database may be SQL language, that is, the second access request is an SQL access statement, and the specific content is determined by the access requirement. Accordingly, the relational database supports a data organization format that is a relational model. That is, if the existing database is a relational database, the data in the storage space of the database managed by the database management apparatus provided in this embodiment is stored in a relational model. For another example, if the existing database is a document type database, the data in the storage space of the database provided in the present embodiment is stored in a document format. In fig. 1a and 1c, only the existing database is used as the relational database, and data in the storage space of the database managed by the database management device is stored in the relational model for illustration, but not limited thereto.
In this embodiment, the database kernel may be implemented on the basis of a kernel of an existing database, and a protocol processing module is provided to convert an access request having a language format supported by the database managed by the database management device into an access request having a language format supported by the existing database, so that the database kernel may access a storage space of the database according to the access request having the language format supported by the existing database, thereby implementing access to the database. When the database is developed, the kernel of the database which is developed in the prior art can be used for developing, the development workload can be reduced without starting from zero, and the database development efficiency can be improved.
It should be noted that, in the embodiment of the present application, the database management device may be a computer device in which the database engine is located. The protocol processing module 11 and the database kernel 12 are software modules included in the database engine.
In some embodiments, as shown in fig. 1c, the protocol processing module 11 includes: a protocol parsing component 11a and a protocol conversion component 11 b. The protocol analysis component 11a may perform semantic analysis on the first access request to obtain the access requirement content of the first access request. Optionally, the protocol parsing component 11a may compile the first access request into an Abstract Syntax Tree (AST), and perform error detection on the statement of the first access request in the process, so as to ensure that the input request statement has no Syntax and lexical errors. For example, it is detected whether there is a keyword spelling error, whether there are redundant punctuation marks, whether the entire sentence is legal, and so on.
Further, the protocol parsing component 11a may sequentially check the nodes of the abstract syntax tree, attach metadata of the relevant table and metadata of the attribute to the syntax tree, and finally generate a syntax tree (bound AST) containing semantics. Further, the protocol parsing component 11a may obtain the access requirement content of the first access request according to the syntax tree containing semantics.
Further, the protocol conversion component 11b may edit the access requirement content according to the target language format, so as to obtain the second access request with the target language format. For example, the existing database is a relational database, and the access requirement content can be edited according to the SQL language to obtain the second access request written in the SQL language.
In some embodiments, as shown in FIG. 1c, the database kernel 12 may include: an optimizer 12a, an executor 12b, and a storage engine 12 c. Optimizer 12a may generate an execution plan based on the second access request having the target language format; accordingly, the executor 12b may invoke the storage engine 12c to access the storage space of the database according to the execution plan.
Since the storage space stores data in a relational model (also referred to as a table), the table is also of a different type. The types of tables are different, and the corresponding access mechanisms are different. The storage engine 10c may be understood to be an implementation of the techniques of how data is stored, how indexes are built for the stored data, and how the data is updated, queried, etc. Thus, the storage engine 10c may also be referred to as a table type (i.e., a type that stores and operates on such a table).
Alternatively, the optimizer 12a may generate a Logical Operator Tree (LOT) from the semantic syntax tree. Alternatively, the optimizer 12a may map semantic syntax tree nodes to operator nodes, resulting in a logical execution tree. Each node on the logical execution tree is called a logical operator. Further, the optimizer 12a may expand a physical operator (physical operator) corresponding to each logical operator to obtain a physical execution tree. Further, the executor 12a may select a least expensive physical execution tree from the physical execution trees as the execution plan. The minimum cost may be shortest path, smallest memory consumption, smallest amount of computation, or shortest computation time, etc. Further, the executor 12b may load codes of the corresponding operators according to the execution plan, then sequentially execute the codes, and call the storage engine 12c of the database to access the storage space of the database.
Based on the above analysis, the executor 12b includes operators that operate on the data organization formats that the database should support. Based on this, an operator that operates on the data organization format that the database management apparatus manages should support may be further added to the executor 12 b. For example, the database management apparatus according to the present embodiment manages a document-type database, a relational database is already provided, and for the document-type database, the operators in the executor 12b include operators for operating on a document. Operators for operating on documents are more than operators for operating on relational models, and operators for operating on documents are not supported by operators of executors of existing relational databases, and operators for operating on documents can be added to the executors 12 b.
In addition to adding an operator for operating a data organization format that should be supported by a database, the executor 12b of the database management apparatus provided in the embodiment of the present application may further include an operator for operating a data organization format that is supported by an existing database. For example, if the existing database is a relational database, the executor 12b may further include: an operator that operates on the relational model.
In this embodiment, in order to be compatible with other existing databases of the same type as the database managed by the database management apparatus provided in this embodiment, a new data type may be added. For example, if the database managed by the database management apparatus provided in this embodiment is a document type database, the existing document type database may support the Json format, the Bson format, and the like, and the database managed by the database management apparatus provided in this embodiment may add a new data type to be compatible with the existing Json and Bson formats. Accordingly, the storage engine 12c of the database may support the newly added data type. Thus, the storage engine 12c of the database supports more data types than the storage engine of an existing database.
Further, as the number of data types supported by the storage engine 12c of the database increases, operators adapted to the data types supported by the storage engine 12c of the database may be included in the executor 12b of the database. For example, the database is a document type database, and the data types supported by the existing document type database include: as shown in fig. 1c, in this embodiment, pbson data types may be newly added, where pbson refers to a data type compatible with Json and Bson. Accordingly, operators may be added to the executor 12b of the database that fit the pbson data type, such as pbson- > "name", pbson _ update, pbson _ match, etc., as shown in FIG. 1 c. The database management device provided by the embodiment can support access to the database. Accessing the database generally includes: inquiring and updating data stored in the database, wherein the data updating comprises the following steps: data addition, deletion, modification, etc., but is not limited thereto.
In some embodiments, the access request is a query request, and the query request includes an identification of a target data source corresponding to the data to be queried. In the embodiment of the present application, the data source refers to a source of data, and the data source identifier refers to information identifying the source of the data. The identification of the target data source may be, but is not limited to, the data storage system where the data to be queried is located, and the file, table, data row, column, etc. in the data storage system. For the existing database is a relational database, the identifier of the target data source may be information of the data storage system where the data to be queried is located, a table in the data storage system, and a row and a column in the table.
Further, for the executor 12b, the storage engine 12c that may invoke the database obtains the target data pointed to by the identifier of the target data source from the storage space, and provides the target data to the client that issued the query request in the target data organization form that the database should support according to the embodiment of the present application.
Accordingly, the storage engine 12c of the database may organize the target data in the target data organization form that the database provided by the embodiment of the present application should support, and provide the target data in the target data organization form to the executor 12 b. Further, the executor 12b sends the target data having the target data organization format to the client that issued the query request. For example, if the database provided in the embodiment of the present application is a document type database, the storage engine 12c organizes the target data in a document format and provides the target data having the document format to the executor 12b as shown in fig. 1 d. Further, the executor 12b provides the target data in a document format to the client that issued the query request. Where the left side in fig. 1d shows the data organization form of the relational database, in the present embodiment, the storage engine 12c may convert the target data organized in the relational model into the target data organized in the document form and supply the target data organized in the document format to the executor 12 b.
In some embodiments, the access request is an update request, and the update request includes an identifier of a target data source corresponding to the data to be updated and an update operation type performed on the data to be updated. Accordingly, the executor 12b may invoke the storage engine 12c of the database to identify, from the storage space, the target data to which the update request contains the identification of the target data source; and updating the target data according to the updating operation type. For example, if the update operation type is delete target data, the executor 12b calls the storage engine 12c to delete the target data. For another example, if the update operation type is to modify the target data, the update request further includes new data, the new data is used to replace the target data, and accordingly, the executor 12b calls the storage engine 12c to modify the target data into the new data carried by the update request. For another example, if the update operation type is to add data, the update request further includes data to be inserted; the executor 12b invokes the storage engine 12c to insert the data to be inserted into the storage location pointed to by the target data source.
In addition to the databases provided in the above embodiments, embodiments of the present application also provide a database access method, which is exemplarily described below.
Fig. 2 is a schematic flowchart of a database access method according to an embodiment of the present application. As shown in fig. 2, the method includes:
201. a first access request is obtained in a language format supported by a first database.
202. Converting the first access request into a second access request; the second access request has a target language format supported by the second database.
203. Accessing a storage space of the first database according to the second access request with the target language format; the data in the storage space is stored in a data organization format supported by the second database.
In this embodiment, the kernel of the first database is implemented on the basis of the kernel of the second database. The second database is an existing database. Optionally, the type of the first database may be the same as or different from the type of the second database. For the description of the database types, reference may be made to the relevant contents of the above embodiments, which are not described herein again. In the embodiment, the kernel logic of the developed database is used for realizing the kernel of another database, so that the development workload can be reduced, and the development efficiency can be improved.
In practical applications, a database needs to have the following functions: (1) creating a database and a data storage unit; (2) storing the data; (3) database access is supported. The embodiment of the application defines the database type by a data organization structure which is sensed by a user. Based on this, when accessing the database, the user submits the access request according to the language format supported by the user-sensible database type, and therefore, the access request has the language format supported by the first database. Accordingly, in step 201, an access request having a language format supported by the first database may be obtained.
Further, since the kernel of the first database is implemented based on the kernel of the second database, the kernel of the first database cannot directly process access requests having a language format supported by the first database. Based on this, in step 202, the access request in the language format supported by the database provided in this embodiment is converted into an access request in the target language format supported by the existing database. In this embodiment, for convenience of description and distinction, an access request having a language format supported by the database provided in this embodiment is defined as a first access request; and converting the first access request into an access request with a target language format supported by the existing database, and defining the access request as a second access request.
Further, in step 203, the storage space of the first database may be accessed according to a second access request having a target language format. In this embodiment, since the kernel of the first database is implemented based on the kernel of the second database, the data in the storage space of the first database is stored in the data organization format supported by the second database.
The types of the existing second databases are different, and the language format and the data organization format supported by the second databases are also different. For example, the second database is a relational database, and the language format supported by the second database may be SQL language, that is, the second access request is an SQL access statement, and the specific content is determined by the access requirement. Accordingly, the relational database supports a data organization format of a relational model. That is, if the second database is a relational database, the data in the storage space of the first database is stored in a relational model. For another example, if the second database is a document type database, the data in the storage space of the first database is stored in a document format.
In this embodiment, the database kernel may be implemented based on the kernel of the existing database, and the access request in the language format supported by the first database is converted into the access request in the language format supported by the existing database, so that the storage space of the database may be accessed according to the access request in the language format supported by the existing database, thereby implementing access to the database. When the database provided by the embodiment of the application is developed, the database can be developed by utilizing the kernel of the database which is developed and completed at present, the development workload can be reduced without starting from zero, and the improvement of the development efficiency of the database is facilitated.
In some embodiments, one implementation of step 202 is: performing semantic analysis on the first access request to obtain access requirement content of the first access request; editing the access requirement content according to the target language format to obtain a second access request with the target language format.
In other embodiments, one implementation of step 203 is: generating an execution plan according to the second access request with the target language format; the memory space is accessed according to the execution plan.
Optionally, the first access request is a query request, and the query request includes: and the identifier of the first target data source corresponding to the data to be queried. Accordingly, an alternative embodiment for accessing the storage space according to the execution plan is: acquiring target data pointed by the identifier of the first target data source from the storage space according to the execution plan; and providing the target data to the client sending the query request according to the data organization format supported by the first database.
Optionally, the first database is a document-type database; the data organization form that the document type database should support is a document format.
Optionally, the first access request is an update request; the update request includes: the identifier of the second target data source corresponding to the data to be updated and the updating operation type of the data to be updated. Accordingly, another embodiment of accessing the storage space according to the execution plan is: identifying target data pointed to by the identification of the second target data source from the storage space; and updating the target data according to the updating operation type.
In some embodiments, the storage engine of the first database supports more data types than the storage engine of the second database.
Further, the executor of the first database includes: an operator adapted to a data type supported by a storage engine of the first database.
Optionally, the operator in the executor of the first database further comprises: operators operating on the data organization format supported by the second database.
In further embodiments, the operators in the executor of the first database further comprise: and an operator for operating on the data organization form that the first database should support.
It should be noted that the execution subjects of the steps of the methods provided in the above embodiments may be the same device, or different devices may be used as the execution subjects of the methods. For example, the execution subjects of steps 201 and 202 may be device a; for another example, the execution subject of step 201 may be device a, and the execution subject of step 202 may be device B; and so on.
In addition, in some of the flows described in the above embodiments and the drawings, a plurality of operations are included in a specific order, but it should be clearly understood that the operations may be executed out of the order presented herein or in parallel, and the sequence numbers of the operations, such as 201, 202, etc., are merely used for distinguishing different operations, and the sequence numbers do not represent any execution order per se. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel.
Accordingly, embodiments of the present application also provide a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the database access method described above.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 3, the computer apparatus includes: a memory 30a and a processor 30 b. A memory 30a for storing a computer program. In this embodiment, the memory 30a may provide a storage space of the first database.
The processor 30b is coupled to the memory 30a for executing a computer program for: acquiring a first access request with a language format supported by a first database; converting the first access request into a second access request; the second access request has a target language format supported by the second database; and accessing the storage space of the first database according to the second access request with the target language format; the data in the storage space is stored in a data organization format supported by the second database. Wherein the kernel of the first database is implemented on the basis of the kernel of the second database.
Optionally, the second database is of a different type than the first database.
Optionally, the first database is a document-type database. The data organization format supported by the document type database is a document format.
Optionally, the second database is a relational database; the relational database supports a data organization format of a relational model.
In some embodiments, when the processor 30b converts the first access request into the second access request, it is specifically configured to: performing semantic analysis on the first access request to obtain access requirement content of the first access request; editing the access requirement content according to the target language format to obtain a second access request with the target language format.
In other embodiments, the processor 30b, when accessing the storage space of the first database, is specifically configured to: and generating an execution plan according to the second access request with the target language format, and accessing the storage space according to the execution plan.
Further, the first access request is a query request, and the query request includes: and the identifier of the first target data source corresponding to the data to be queried. When accessing the storage space, the processor 30b is specifically configured to: acquiring target data pointed by the identifier of the first target data source from the storage space according to the execution plan; and providing the target data to the client sending the query request according to the data organization format supported by the first database.
Optionally, the first database is a document-type database; the data organization form that the document type database should support is a document format.
In some embodiments, the first access request is an update request; the update request includes: the identifier of the second target data source corresponding to the data to be updated and the updating operation type of the data to be updated. The processor 30b, in accessing the memory space, includes: identifying target data pointed to by the identification of the second target data source from the storage space; and updating the target data according to the updating operation type.
In some embodiments, the storage engine of the first database supports more data types than the storage engine of the second database.
Further, the executor of the first database includes: an operator adapted to a data type supported by a storage engine of the first database.
Optionally, the operator in the executor of the first database further comprises: operators operating on the data organization format supported by the second database.
In further embodiments, the operators in the executor of the first database further comprise: and an operator for operating on the data organization form that the first database should support.
In some optional embodiments, as shown in fig. 3, the computer device may further include: communication component 30c and power component 30 e. In some embodiments, the computer device may be a terminal device such as a computer, and as shown in fig. 3, the computer device may further include: display 30e, audio component 30f, and the like. Only some of the components shown in fig. 3 are schematically depicted, and it is not meant that the computer device must include all of the components shown in fig. 3, nor that the computer device only includes the components shown in fig. 3.
In embodiments of the present application, the memory is used to store computer programs and may be configured to store other various data to support operations on the device on which it is located. Wherein the processor may execute a computer program stored in the memory to implement the corresponding control logic. The memory may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
In the embodiments of the present application, the processor may be any hardware processing device that can execute the above described method logic. Alternatively, the processor may be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), or a Micro Controller Unit (MCU); programmable devices such as Field-Programmable Gate arrays (FPGAs), Programmable Array Logic devices (PALs), General Array Logic devices (GAL), Complex Programmable Logic Devices (CPLDs), etc. may also be used; or Advanced Reduced Instruction Set (RISC) processors (ARM), or System On Chip (SOC), etc., but is not limited thereto.
In embodiments of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component may also be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, or other technologies.
In the embodiment of the present application, the display screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the display screen includes a touch panel, the display screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
In embodiments of the present application, a power supply component is configured to provide power to various components of the device in which it is located. The power components may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device in which the power component is located.
In embodiments of the present application, the audio component may be configured to output and/or input audio signals. For example, the audio component includes a Microphone (MIC) configured to receive an external audio signal when the device in which the audio component is located is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in a memory or transmitted via a communication component. In some embodiments, the audio assembly further comprises a speaker for outputting audio signals. For example, for devices with language interaction functionality, voice interaction with a user may be enabled through an audio component, and so forth.
The computer device provided by the embodiment can realize the database kernel on the basis of the kernel of the existing database, and convert the access request with the language format supported by the first database into the access request with the language format supported by the existing database, so that the storage space of the database can be accessed according to the access request with the language format supported by the existing database, and the access to the database is realized. In the embodiment, when the database is developed, the kernel of the developed database can be used for development, so that the development workload can be reduced without starting from zero, and the improvement of the development efficiency of the database is facilitated.
Fig. 4 is a schematic structural diagram of a data volume access device according to an embodiment of the present application. As shown in fig. 4, the apparatus includes: an acquisition module 40a, a processing module 40b and an access module 40 c.
In this embodiment, the obtaining module 40a is configured to obtain the first access request in a language format supported by the first database. The processing module 40b is configured to convert the first access request into a second access request; the second access request has a target language format supported by a second database; wherein the kernel of the first database is implemented on the basis of the kernel of the second database. An accessing module 40c, configured to access a storage space of the first database according to a second access request having the target language format; and the data in the storage space is stored in a data organization format supported by the second database.
Optionally, the second database is of a different type than said first database.
Optionally, the first database is a document-type database. The data organization format supported by the document type database is a document format.
Optionally, the second database is a relational database; the relational database supports a data organization format of a relational model.
In some embodiments, the processing module 40b includes: a parsing unit 40b1 and a converting unit 40b 2. The parsing unit 40b1 is configured to perform semantic parsing on the first access request to obtain the access requirement content of the first access request. The converting unit 40b2 is configured to edit the access requirement content according to the target language format, so as to obtain a second access request having the target language format.
In other embodiments, the accessing module 40c is specifically configured to, when accessing the storage space of the first database: generating an execution plan according to the second access request with the target language format; and accessing the storage space according to the execution plan.
Further, the first access request is a query request, and the query request includes: and the identifier of the first target data source corresponding to the data to be queried. When accessing the storage space, the accessing module 40c is specifically configured to: according to the execution plan, acquiring target data pointed by the identifier of the first target data source from the storage space; and providing the target data to the client sending the query request according to the data organization format supported by the first database.
Optionally, the first access request is an update request; the update request includes: the identification of a second target data source corresponding to the data to be updated and the updating operation type of the data to be updated; when accessing the storage space, the accessing module 40c is specifically configured to: identifying target data pointed to by the identification of the second target data source from the storage space; and updating the target data according to the updating operation type.
In some embodiments, the storage engine of the first database supports more data types than the storage engine of the second database.
Further, the executor of the first database includes: an operator adapted to a data type supported by a storage engine of the first database.
Optionally, the operator in the executor of the first database further comprises: operators operating on the data organization format supported by the second database.
In further embodiments, the operators in the executor of the first database further comprise: and an operator for operating on the data organization form that the first database should support.
The database access device provided by the embodiment can realize the kernel of another database based on the kernel of the existing database, and convert the access request with the language format supported by the other database into the access request with the language format supported by the existing database, so that the storage space of the database can be accessed according to the access request with the language format supported by the existing database, and the access to the database is realized. When the database provided by the embodiment of the application is developed, the database can be developed by utilizing the kernel of the database which is developed and completed at present, the development workload can be reduced without starting from zero, and the improvement of the development efficiency of the database is facilitated.
It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (19)

1. A database access method, comprising:
acquiring a first access request with a language format supported by a first database;
converting the first access request into a second access request; the second access request has a target language format supported by an existing second database;
accessing a storage space of the first database according to a second access request with the target language format; the data in the storage space is stored in a data organization format supported by the second database;
wherein the kernel of the first database is implemented on the basis of the kernel of the second database.
2. The method of claim 1, wherein the second database is of a different type than the first database.
3. The method of claim 1, wherein converting the first access request into a second access request comprises:
performing semantic analysis on the first access request to obtain access requirement content of the first access request;
and editing the access requirement content according to the target language format to obtain a second access request with the target language format.
4. The method of claim 1, wherein said accessing a storage space of the first database in accordance with the second access request having the target language format comprises:
generating an execution plan according to the second access request with the target language format;
and accessing the storage space according to the execution plan.
5. The method of claim 4, wherein the first access request is a query request, and wherein the query request comprises: the identification of a first target data source corresponding to the data to be queried;
accessing the storage space according to the execution plan includes:
according to the execution plan, acquiring target data pointed by the identifier of the first target data source from the storage space;
and providing the target data to a client sending the query request according to a data organization format supported by the first database.
6. The method of claim 4, wherein the first access request is an update request; the update request includes: the identification of a second target data source corresponding to the data to be updated and the updating operation type of the data to be updated;
accessing the storage space according to the execution plan includes:
identifying target data pointed to by the identification of the second target data source from the storage space;
and updating the target data according to the updating operation type.
7. The method of any of claims 1-6, wherein the storage engine of the first database supports more data types than the storage engine of the second database.
8. The method of claim 7, wherein the executor of the first database comprises: an operator adapted to a data type supported by a storage engine of the first database.
9. The method of claim 8, wherein the operators in the executor of the first database further comprise: operators operating on data organization formats supported by the second database.
10. The method of any of claims 1-6, wherein operators in the executor of the first database further comprise: and the operator is used for operating the data organization form which is supported by the first database.
11. The method of claim 10, wherein the first database is a document-type database; the data organization form supported by the document type database is a document format.
12. The method of any of claims 1-6, wherein the second database is a relational database; the relational database supports a data organization format of a relational model.
13. A database management apparatus, comprising: the system comprises a protocol processing module and a database kernel; the database kernel is realized on the basis of the kernel of the existing database;
the protocol processing module is used for converting the first access request with the language format supported by the database into a second access request; the second access request has a target language format supported by the existing database;
the database kernel is used for accessing the storage space of the database according to a second access request with the target language format;
and the data in the storage space is stored in a data organization format supported by the existing database.
14. The apparatus according to claim 13, wherein the type of database managed by the database management apparatus is different from the type of the existing database.
15. The apparatus of claim 13, wherein the protocol processing module comprises: a protocol analysis component and a protocol conversion component;
the protocol analysis component is used for performing semantic analysis on a first access request to obtain access requirement content of the first access request;
and the protocol conversion component is used for editing the access requirement content according to the target language format to obtain a second access request with the target language format.
16. The apparatus of claim 13, wherein the database kernel comprises: an optimizer, an executor, and a storage engine;
the optimizer is used for generating an execution plan according to the second access request with the target language format;
and the executor is used for calling the storage engine to access the storage space according to the execution plan.
17. A database access apparatus, comprising: the system comprises an acquisition module, a processing module and an access module; wherein the content of the first and second substances,
the acquisition module is used for acquiring a first access request with a language format supported by a first database;
the processing module is used for converting the first access request into a second access request; the second access request has a target language format supported by a second database; wherein the kernel of the first database is implemented on the basis of the kernel of the second database;
the access module is used for accessing the storage space of the first database according to a second access request with the target language format; and the data in the storage space is stored in a data organization format supported by the second database.
18. A computer device, comprising: a memory and a processor; wherein the memory is used for storing a computer program;
the processor is coupled to the memory for executing the computer program for performing the steps of the method of any of claims 1-12.
19. A computer-readable storage medium having stored thereon computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of any one of claims 1-12.
CN202010235296.0A 2020-03-27 2020-03-27 Database access method, device, equipment and storage medium Active CN113448942B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010235296.0A CN113448942B (en) 2020-03-27 2020-03-27 Database access method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010235296.0A CN113448942B (en) 2020-03-27 2020-03-27 Database access method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113448942A true CN113448942A (en) 2021-09-28
CN113448942B CN113448942B (en) 2022-07-22

Family

ID=77808213

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010235296.0A Active CN113448942B (en) 2020-03-27 2020-03-27 Database access method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113448942B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115062092A (en) * 2022-08-10 2022-09-16 阿里云计算有限公司 Database access method, device, system and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1672150A (en) * 2002-06-21 2005-09-21 住商信息系统株式会社 Views for software atomization
CN105279285A (en) * 2015-11-23 2016-01-27 上海斐讯数据通信技术有限公司 Synchronization system and method of relation-type database and non-relation-type database
CN106547756A (en) * 2015-09-17 2017-03-29 北京国双科技有限公司 The creation method and device of data base
CN106933869A (en) * 2015-12-30 2017-07-07 北京京东尚科信息技术有限公司 A kind of method and apparatus of operating database
CN107016016A (en) * 2016-10-10 2017-08-04 阿里巴巴集团控股有限公司 A kind of method and device of data processing
CN107203387A (en) * 2017-06-13 2017-09-26 广东神马搜索科技有限公司 Target database access method and system
CN107665216A (en) * 2016-07-29 2018-02-06 银联数据服务有限公司 A kind of data bank access method and middleware
CN110851461A (en) * 2019-10-31 2020-02-28 深信服科技股份有限公司 Method and device for auditing non-relational database and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1672150A (en) * 2002-06-21 2005-09-21 住商信息系统株式会社 Views for software atomization
CN106547756A (en) * 2015-09-17 2017-03-29 北京国双科技有限公司 The creation method and device of data base
CN105279285A (en) * 2015-11-23 2016-01-27 上海斐讯数据通信技术有限公司 Synchronization system and method of relation-type database and non-relation-type database
CN106933869A (en) * 2015-12-30 2017-07-07 北京京东尚科信息技术有限公司 A kind of method and apparatus of operating database
CN107665216A (en) * 2016-07-29 2018-02-06 银联数据服务有限公司 A kind of data bank access method and middleware
CN107016016A (en) * 2016-10-10 2017-08-04 阿里巴巴集团控股有限公司 A kind of method and device of data processing
CN107203387A (en) * 2017-06-13 2017-09-26 广东神马搜索科技有限公司 Target database access method and system
CN110851461A (en) * 2019-10-31 2020-02-28 深信服科技股份有限公司 Method and device for auditing non-relational database and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115062092A (en) * 2022-08-10 2022-09-16 阿里云计算有限公司 Database access method, device, system and storage medium
CN115062092B (en) * 2022-08-10 2023-02-03 阿里云计算有限公司 Database access method, device, system and storage medium

Also Published As

Publication number Publication date
CN113448942B (en) 2022-07-22

Similar Documents

Publication Publication Date Title
US11907247B2 (en) Metadata hub for metadata models of database objects
US20230097443A1 (en) One-shot learning for text-to-sql
US10216826B2 (en) Database query system
US20240012810A1 (en) Clause-wise text-to-sql generation
US10452628B2 (en) Data analysis schema and method of use in parallel processing of check methods
US11334549B2 (en) Semantic, single-column identifiers for data entries
CN106844369B (en) Objectification SQL sentence construction method and apparatus
CN110019111B (en) Data processing method, data processing device, storage medium and processor
EP4155965A1 (en) System and method for facilitating metadata identification and import
CN110968579A (en) Execution plan generation and execution method, database engine and storage medium
CN112015754A (en) Data query method, device and system
CN113448942B (en) Database access method, device, equipment and storage medium
CN105867886B (en) Method and device for writing table
CN112541001A (en) Data query method, device, storage medium and equipment
EP3816814A1 (en) Crux detection in search definitions
US11720553B2 (en) Schema with methods specifying data rules, and method of use
CN113448969B (en) Data processing method, device and storage medium
CN115952203B (en) Data query method, device, system and storage medium
CN103116622B (en) A kind of sequence value generation method for Ibatis scheme and device
CN108228604B (en) Model construction method based on memory object, information query method and device
CN116756184B (en) Database instance processing method, device, equipment, storage medium and program product
CN115455035B (en) Data query model construction method and computer-readable storage medium
EP4155968A1 (en) Identification and import of metadata for extensions to database artefacts
CN113157726B (en) Database processing method and device
CN113343036B (en) Data blood relationship analysis method and system based on key topological structure analysis

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