WO2023051125A1 - 结构化数据的版本管理方法、装置及相关设备 - Google Patents

结构化数据的版本管理方法、装置及相关设备 Download PDF

Info

Publication number
WO2023051125A1
WO2023051125A1 PCT/CN2022/115326 CN2022115326W WO2023051125A1 WO 2023051125 A1 WO2023051125 A1 WO 2023051125A1 CN 2022115326 W CN2022115326 W CN 2022115326W WO 2023051125 A1 WO2023051125 A1 WO 2023051125A1
Authority
WO
WIPO (PCT)
Prior art keywords
version
data
structured data
difference
difference data
Prior art date
Application number
PCT/CN2022/115326
Other languages
English (en)
French (fr)
Inventor
凌云
王坤
温林儒
Original Assignee
华为云计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为云计算技术有限公司 filed Critical 华为云计算技术有限公司
Publication of WO2023051125A1 publication Critical patent/WO2023051125A1/zh

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/23Updating

Definitions

  • the present application relates to the technical field of databases, in particular to a version management method, device and related equipment for structured data.
  • the version of the database model can facilitate retrospective modification.
  • the current database design software cannot provide a retrospective function after modifying the database model structure.
  • the script file of the database model can be version managed through the code warehouse.
  • the code warehouse can only record code and data modifications, and the dependencies between various elements of the database are often complicated. It is difficult to trace back the version of the database model by recording script files, and unstructured text is not conducive to users viewing the database. Modification of structure, poor user experience.
  • the embodiment of the present application provides a structured data version management method, device and related equipment, capable of recording changes in structured data, so that users can conveniently view direct iterative changes of different versions.
  • the embodiment of the present application provides a method for version management of structured data, including:
  • the difference data about the first version is obtained, and the difference data about the first version represents the difference between the structured data of the first version and the structured data of the previous version.
  • the difference between the structured data of the previous version, the difference data about the first version includes the identifier of the first version, the identifier of the changed element and the change operation type;
  • the difference data is recorded for the first version.
  • the foregoing method may be applied to a server and executed by the server or components inside the server (such as a chip, a software module, or an integrated circuit).
  • the above method can be applied to the database design system, for example, executed by the server of the database design system.
  • the changes of structured data of different versions are recorded by means of incremental storage, and the record of changes of structured data is realized.
  • users can easily view the direct iterative changes of different versions, which is convenient for users to perform version retrospection and meets the visualization needs of structured data changes.
  • the server records structured data of different versions, there is no need to record the entire structured data, which reduces the amount of records.
  • the embodiment of the present application can conveniently and efficiently implement horizontal backtracking and vertical backtracking.
  • the elements of the version can be conveniently calculated according to the difference data, and the query speed is fast and the efficiency is high.
  • the life cycle of the solution element can be known, and the query speed is fast and the efficiency is high.
  • the structured data includes one or more items of database model data, JSON data, or extensible markup language (extensible markup language, XML) data.
  • the database model data may include elements such as tables, fields, and views, and the above elements may respectively correspond to one or more attributes.
  • JavaScript object notation (JavaScript object notation, JSON) data can usually be used to represent one or more objects or object arrays.
  • JSON data generally speaking, objects are composed of parts enclosed by “curly braces”. Each object It usually consists of one or more attributes and their corresponding values. Different attributes are separated by ",”. It should be understood that objects in JSON data can be regarded as elements.
  • XML data can contain one or more nodes. This node can be seen as an element of XML data.
  • the structured data includes one or more modules; according to the structured data of the first version and the structured data of the previous version, the A version of the diff data, including:
  • the difference data includes corresponding to the one or more Difference data for each module.
  • the deduplication operation can be performed in the order of versions from newest to oldest, so as to obtain the full amount of elements of the current version.
  • the difference data of the latest version of an element with a certain ID is retained, and the element whose operation type includes "delete” (ie: "DROP”) is removed.
  • the method further includes:
  • the structured data of the first version is obtained from the difference data about the first version and the difference data about a version before the first version.
  • the method further includes:
  • a change record of the first element is obtained according to the difference data about the first version, the difference data about a version before the first version, and the information about the first element.
  • the change operation type includes one or more of adding, deleting, or updating.
  • the structured data includes one or more items of database model data, JASON data, or Extensible Markup Language XML data.
  • the structured data includes database model data
  • the elements include one or more of the following element types: tables, fields, indexes, views, or relationships .
  • the embodiment of the present application provides a version management device, the version management device includes an acquisition unit and a processing unit, and the version management device is used to realize the description in the first aspect or any possible implementation manner of the first aspect. method.
  • the acquiring unit is configured to acquire structured data of a first version, where the structured data includes attributes of elements and values corresponding to the attributes;
  • the processing unit is configured to obtain difference data about the first version according to the structured data of the first version and the structured data of a previous version, and the difference data about the first version characterizes the first version A difference between a version of the structured data and the previous version of the structured data, the difference data about the first version includes an identifier of the first version, an identifier of an element that has been changed, and a change operation type;
  • the processing unit is further configured to record the difference data corresponding to the first version.
  • the structured data includes one or more modules, and each module includes attributes of some elements and values corresponding to the attributes of the elements;
  • the processing unit is also used for:
  • the difference data includes corresponding to the one or more Difference data for each module.
  • the processing unit may perform deduplication operations in order of versions from newest to oldest to obtain the full amount of elements of the current version.
  • the processing unit when it performs a deduplication operation, it may retain the latest version difference data of an element with a certain ID, and remove an element whose operation type includes "delete” (ie, "DROP").
  • DROP delete
  • the acquiring unit is further configured to receive first request information from a user equipment, where the first request information is used to request the structured data of the first version ;
  • the processing unit is further configured to obtain the structured data of the first version according to the difference data about the first version and the difference data about a version before the first version.
  • the acquiring unit is further configured to receive second request information from the user equipment, where the second request information is used to request a change record of the first element, the the first element belongs to the one or more elements;
  • the processing unit is further configured to obtain a change record of the first element according to the difference data about the first version, the difference data about a version before the first version, and the information about the first element.
  • the change operation type includes one or more of adding, deleting, or updating.
  • the structured data includes one or more items of database model data, JSON data, or Extensible Markup Language XML data.
  • the structured data includes database model data
  • the one or more elements include one or more of the following element types: tables, fields, indexes, view, or relationship.
  • the embodiment of the present application provides a computing device, the computing device includes a processor and a memory; a computer program is stored in the memory; when the processor executes the computer program, the computing device executes any one of the aforementioned first to fourth aspects. described method.
  • the processor contained in the data transmission device described in the eleventh aspect above may be a processor dedicated to executing these methods (referred to as a dedicated processor for easy distinction), or it may be A processor, such as a general-purpose processor, to execute these methods.
  • at least one processor may also include both a special-purpose processor and a general-purpose processor.
  • the above computer programs may be stored in memory.
  • the memory can be a non-transitory (non-transitory) memory, such as a read-only memory (Read Only Memory, ROM), which can be integrated with the processor on the same device, or can be respectively arranged on different devices , the embodiment of the present application does not limit the type of the memory and the arrangement of the memory and the processor.
  • ROM Read Only Memory
  • the at least one memory is located outside the computing device.
  • the at least one memory is located within the computing device.
  • part of the memory of the at least one memory is located inside the computing device, and another part of the memory is located outside the computing device.
  • processor and the memory may also be integrated into one device, that is, the processor and the memory may also be integrated together.
  • an embodiment of the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on at least one processor, any of the aforementioned first to fourth aspects can be realized. A described method.
  • the present application provides a computer program product, the computer program product includes computer instructions, and when the instructions are run on at least one processor, the method described in any one of the first to fourth aspects above is implemented.
  • the computer program product may be a software installation package, and the computer program product may be downloaded and executed on a computing device if the foregoing method needs to be used.
  • Fig. 1 is a schematic diagram of changing a database model provided by an embodiment of the present application
  • Fig. 2 is a schematic diagram of the architecture of a database design system provided by the embodiment of the present application.
  • Fig. 3 is a schematic flowchart of a version management method provided by an embodiment of the present application.
  • Fig. 4 is a schematic diagram of JSON data provided by the embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of some possible difference data provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of multiple versions of structured data provided by an embodiment of the present application.
  • Fig. 7 is a schematic diagram of difference data about multiple versions provided by the embodiment of the present application.
  • FIG. 8 is a schematic flowchart of another version management method provided by the embodiment of the present application.
  • FIG. 9 is a schematic diagram of information of multiple versions provided by an embodiment of the present application.
  • Fig. 10 is a schematic flowchart of another version management method provided by the embodiment of the present application.
  • Fig. 11 is a schematic structural diagram of a version management device provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a computing device provided by an embodiment of the present application.
  • a database (database, DB) is a warehouse that organizes, records and manages data according to the data structure, and is an organized and shareable collection of large amounts of data recorded in a computer.
  • Tables can record specific types of data, such as student information, department directories, and so on. Each table has attributes such as a table id, table name, comments, etc.
  • a table includes one or more columns, each column is a field in the table, and each column records information of a certain part of the table.
  • the database may contain a table named "student", one column records the student identification number (student identification, or referred to as student ID), and one column records the student's name (name).
  • Fields can contain attributes such as field name, field type, etc.
  • database libraries, tables, fields, etc. can be regarded as elements in the database.
  • elements in the database can also include elements such as indexes, views, and relationships, which will not be introduced here.
  • the database design system is a visual database design and management tool for designing, building, using and maintaining databases. Users can create (or edit) in the database design system design views including elements and the relationship between elements, and the database design system can record the database design views created (or edited) by users, and can establish database models (or also include record data in the database).
  • users in this application may include users of the database design system, including users, managers, designers, or developers of the database design system.
  • Version management refers to the management of data changes such as codes, documents, and model designs during the development process, and is one of the core ideas of process management in development iterations.
  • Structured data contains attributes of elements and their corresponding values. It is difficult to record changes in structured data through version management methods based on text and strings. When users iterate on structured data, it is difficult to go back and experience poor experience. .
  • database model data is structured data. There are one or more elements in a database (or database model), and elements can contain attributes, or sub-attributes, etc., and there are even associations between elements. If version management is performed based on text, string, etc. version management methods, when comparing differences between different versions of databases (or database models), what you see will be messy text blocks, which makes it difficult to intuitively understand the differences, and the experience is poor.
  • structured data such as JSON data and XML data all face the problem of version management.
  • FIG. 1 is a schematic diagram of a possible database model provided by the embodiment of the present application.
  • the student database model is shown.
  • a student table (student) and a teacher table (teacher) are added to the student database, corresponding to the student entity and the teacher entity respectively.
  • the student table (student entity) can contain the following fields (attributes): student number, job number (sutdent_ID), class number (class_ID), start date (date), and the teacher table (teacher entity) can contain the following fields (attributes): Teacher ID (teacher_ID), name (teacher_name), gender (sex), and entry date (hiredate).
  • the class table can contain the following fields (attributes): class number (class_ID), class name (class_name), teacher name (teacher_name). Among them, the class number in the class table is associated with the student number in the student table, and the teacher name in the class table is associated with the name in the teacher table.
  • update table attributes such as modifying table name, or comment, etc.
  • update field attributes such as modifying field name, modify field type
  • update views update functions, etc. in the database.
  • the embodiments of the present application provide a structured data version management method, device and related equipment, which can record changes in structured data, so that users can conveniently view direct iterative changes of different versions.
  • the version management method provided by the embodiment of the present application can be implemented based on a database design system, or can be implemented based on other systems and devices that can design, create, and edit database model data.
  • the database design system may include hardware modules, or software modules (such as application programs, components, etc.), or a combination of hardware modules and software modules, and the like.
  • the database design system may include a client and a server.
  • the client can be used to present interfaces, selection boxes, input boxes and other components that interact with users, and the server can be used to provide structured data of the database model to the client, or respond to user requests, etc.
  • FIG. 2 is a schematic diagram of a possible database design system provided by an embodiment of the present application.
  • the system shown in FIG. 2 includes at least one user equipment 201 and at least one server 202 .
  • the user equipment 201 is an electronic equipment capable of data processing and data sending and receiving, and can realize the aforementioned functions of the client.
  • it may include independent devices such as handheld terminals, wearable devices, vehicles, and robots, and may also be components (such as chips or integrated circuits) included in independent devices.
  • the terminal device when the terminal device is a handheld terminal, it may be a mobile phone (mobile phone), a tablet computer (pad), a computer (such as a notebook computer, a palmtop computer, etc.) and the like.
  • the server 202 is a device capable of data processing and data sending and receiving, and can realize the aforementioned functions of the server. It should be understood that it is referred to as a server for convenience of description here, and its specific form may be a physical device such as a server or a host, or a virtual device such as a virtual machine or a container. Optionally, the server 202 may be independently deployed on one device, or may be distributed and deployed on multiple devices.
  • the server 202 can receive a request to create a database, a request to modify a database, etc.
  • the server can record the difference data between the two versions through the modified database model data and the currently recorded database model data, so as to realize the structured Data change management. Moreover, there is no need to record the entire database every time, reducing the amount of storage.
  • a certain version of the database can be obtained according to one or more versions of the difference data during horizontal backtracking; during vertical backtracking, by backtracking operations such as creating, modifying, or deleting an element, You can view the life cycle of an element vertically. Users can easily backtrack horizontally and vertically to improve user experience.
  • the communication link between the server 202 and the user equipment 201 may be a wired link, a wireless link, or a combination of a wired link and a wireless link. Further optionally, communication may also be implemented through one or more network technologies. This application does not limit the communication manner between the server and the user equipment 201 .
  • the server 202 shown in FIG. 2 may be a cloud platform.
  • the cloud platform includes a large number of basic resources provided by the cloud service provider (including but not limited to computing resources, recording resources, or network resources, etc.), where the computing resources can be a large number of computing devices (such as servers, virtual machines).
  • the above database design system can be abstracted into a database design cloud service by a cloud service provider on a cloud platform and provided to users.
  • the cloud platform responds to the database design system instance creation operation triggered by the user, creates the database design system instance on the resources provided by the cloud service provider, and then provides the user with database model version management services.
  • the user equipment used by the user can present an interface and use the version management service.
  • the method of purchasing the database design cloud service may include: pre-charging first and then making settlement according to the actual usage of the final resources, or making settlement according to the time of using the cloud service or according to the functions or resources of the purchased cloud service.
  • the cloud platform may be a cloud platform of the central cloud, a cloud platform of the edge cloud, or a cloud platform including the central cloud and the edge cloud, which is not specifically limited in the embodiment of the present application.
  • the database design system may be partially deployed on the edge cloud cloud platform and partially deployed on the central cloud cloud platform.
  • FIG. 3 is a schematic flowchart of a method for version management provided by an embodiment of the present application.
  • the method can be applied to the aforementioned version management system, such as the database design system shown in FIG. 2 .
  • the version management method shown in FIG. 3 includes at least step S301 to step S302. It should be understood that, for the convenience of description, the present application uses the sequence of S301 to S302 for description, and does not intend to limit the execution to be performed in the above sequence. The embodiment of the present application does not limit the execution sequence, execution time, and execution times of the above one or more steps. Step S301 to step S302 are specifically as follows:
  • Step S301 the server obtains the structured data of the first version.
  • the server is a device having a data processing function.
  • a server for the convenience of description, and it does not limit that the method must be implemented by a server, for example, it can also be implemented by a virtual machine or a host.
  • structured data is data with a relatively fixed pattern.
  • Structured data contains the attributes of an element and the values corresponding to the containing attributes.
  • a certain version of structured data can also be empty data, that is, it does not contain attributes of elements.
  • attributes in structured data is related to one or more elements (or called objects), and the attribute is an attribute of one or more elements (or called objects) indicated by the structured data.
  • attributes in structured data may include attributes such as table names, table comments, field names, and field types, among which tables and fields are elements (or objects).
  • structured data can obtain corresponding information through key-value (key-value).
  • the type of structured data may belong to one or more items of database model data, JavaScript object notation (JSON) data, or extensible markup language (extensible markup language, XML) data.
  • JSON JavaScript object notation
  • XML extensible markup language
  • the database model data may include elements such as tables, fields, and views, and the above elements may respectively correspond to one or more attributes.
  • the database model data can be incrementally stored, which has the advantages of small data storage capacity, fast storage speed, fast query speed and the like.
  • JSON data can usually be used to represent one or more objects or arrays of objects. In JSON data, generally speaking, objects are composed of parts enclosed by "braces". Each object usually contains one or more attributes and their corresponding values. Different attributes are separated by ",”. It should be understood that objects in JSON data can be regarded as elements.
  • XML data can contain one or more nodes. This node can be seen as an element of XML data.
  • the database model data includes multiple tables, and each table corresponds to a kind of entity.
  • Table A table can contain multiple attributes, such as one or more attributes such as table name and field.
  • a field in a table can also be regarded as an element, and a field can also contain multiple attributes, such as field name, data format, field ID, and other attributes.
  • FIG. 4 is a schematic structural diagram of a possible JSON data provided by an embodiment of the present application.
  • an object in the JSON format can contain multiple attributes.
  • the object with the table name "tb_teacher" can contain multiple attributes such as table name, comment, table ID, and field.
  • the value of the field attribute can be an array containing multiple objects, and each object in the array contains multiple attributes respectively. The details will not be introduced one by one.
  • the server may receive the structured data of the first version from other devices, so as to obtain the structured data of the first version.
  • the user can create, edit or delete one or more elements in the structured data, or edit the attributes of elements, etc. in the user equipment, so as to obtain different versions of the structured data.
  • the user saves or submits the structured data of the first version in the user equipment, and correspondingly, the server may receive the structured data of the first version from the user equipment.
  • the server can generate the first version of the structured data itself.
  • the user may indicate modification of the structured data through the indication information, and the server generates the first version of the structured data based on the original structured data and the indication information.
  • Step S302 The server obtains difference data about the first version according to the structured data of the first version and the structured data of the previous version.
  • the last version refers to a version before the first version recorded in the server.
  • the difference data of the first version represents the difference between the structured data of the first version and the structured data of the previous version.
  • the difference data about the first version includes an identification of the first version, an identification of the element where there is a change, and a change operation type.
  • the identification of the first version may also be referred to as a version number, or version information.
  • the first version may be the second modification of the structured data, and the identifier of the first version may be "version (version, or ver.) 2".
  • the changed element may be, for example, a table or a field as shown in FIG. 1 , or, for example, an object named “tb_teacher” as shown in FIG. 4 .
  • the identifier of the element is used to indicate the element, for example, it may include one or more items of element ID, serial number and so on.
  • the change operation type includes one or more operation types of add, delete, or update. Further, it may also include adding, deleting or modifying attributes corresponding to elements.
  • the user compared with the previous version, the user added a class table in the first version, and the difference data includes the version number of the first version, the ID of the class table, and the operation of the change (ie, increase). Further, the user adds the fields of the class table in the first version, namely: the class number, class name and teacher name fields, then the difference data also includes the version number of the first version, and the ID of the class number, class name and teacher name , Change operation (ie: increase).
  • the difference data includes the version identifier (that is, the version is "2”), the identifier of the changed element (that is, the table ID is "E03"), and the difference type (that is, the ACTION is "ADD" ).
  • the difference data also includes one or more attributes of the class table, such as name or comment.
  • the difference data includes the identifier of the version, the identifier of the changed element (ie: the field IDs are "E08, E09, E10" respectively), the difference type (ie: ACTION to "ADD").
  • the difference data also includes one or more attributes of the above elements, such as field name or field type.
  • the structured data may contain one or more modules, and each module contains part of the structured data.
  • the difference data may include difference data corresponding to the one or more modules.
  • the server divides the first version of the structured data into one or more modules.
  • the previous version of structured data also contained multiple modules.
  • the server compares the structured data of the first version and the structured data of the current version by module to obtain difference data, and the difference data includes difference data corresponding to one or more modules.
  • the structured data shown in part (b) of FIG. 1 may include data of two modules (referred to as a first module and a second module for convenience of description).
  • the first module includes table-related attributes, such as attributes of the student table (such as table ID, table name, or attributes such as comments), attributes of the teacher table, and the like.
  • the second module includes attributes related to fields, for example, attributes related to teacher ID fields (such as attributes such as field ID, field name, or field type), attributes related to teacher ID numbers, and the like.
  • the difference data includes difference data corresponding to the first module, such as part (a) of FIG. 5 .
  • the difference data also includes difference data corresponding to the second module, such as part (b) of Fig. 5 .
  • the modules may be divided according to levels.
  • each of the above one or more modules corresponds to one (or more) levels of structured data.
  • tables and fields in the database model data are divided into two levels. Therefore, the database model data shown in part (b) of FIG. 1 can be divided into two modules.
  • the modules may be obtained according to the hierarchical division of the array.
  • the object whose table ID is E01 belongs to the objects in an array, and thus belongs to a module.
  • the value of the field attribute of the object whose table ID is E01 is another array, so the field attribute can be used as another module.
  • the structured data of the previous version may be obtained based on the difference data about the versions before the first version.
  • the server when it compares the difference data, it may perform comparison according to element identifiers to determine the identifier of the changed element and the difference type. For example, if the structured version data of the previous version contains the ID of element 1, but the structured data of the first version does not contain the ID of element 1, then the operation type corresponding to element 1 in the first version is delete (ie: DROP ). Similarly, if the structured version data of the previous version does not contain the ID of element 2, but the structured data of the first version contains the ID of element 2, then the operation type corresponding to element 2 in the first version is new (ie: ADD).
  • element identifiers For example, if the structured version data of the previous version contains the ID of element 1, but the structured data of the first version does not contain the ID of element 1, then the operation type corresponding to element 1 in the first version is delete (ie: DROP ). Similarly, if the structured version data of the previous version does not contain the ID of element 2, but the structured data of the first version contains the ID of element 2, then
  • the structured data in the previous version contains the ID of element 3, and the first version also contains the ID of element 3, and the attributes corresponding to element 3 can be compared at this time. If element 3 has inconsistent attributes in the two versions, the operation type corresponding to element 3 in the first version is modification (ie: CHANGE); if element 3 does not have inconsistent attributes in the two versions, then element 3 does not There is a change, and correspondingly, the identifier corresponding to element 3 is not included in the difference data.
  • modification ie: CHANGE
  • the version management method shown in FIG. 3 also includes step S303, specifically as follows:
  • Step S303 The server records the difference data corresponding to the first version.
  • the server records the difference data of the first version.
  • the server adds difference data about the first version to total difference data, the total difference data including difference data about one or more versions.
  • Figure 6 is a schematic diagram of a possible multiple versions of structured data provided by this embodiment of the application
  • Figure 7 is a possible schematic diagram of multiple versions of structured data provided by this embodiment of the application Schematic diagram of the difference data of two versions.
  • a teacher table and a student table are newly added in the structured data of version 1, and the difference is shown in area 601 .
  • the difference data about version 1 includes the identification of version 1, the identification of teacher table and student table (respectively E01, E02), difference type, and attributes of teacher table and student table.
  • the difference data about version 2 includes the logo of version 2, the logo of the teacher table (ie: E01), the type of difference (ie: CHANGE) and the attributes of the teacher table.
  • the annotation of the student table is changed from “student” to “student table” in the structured data of version 3, and the difference between version 3 and version 2 is shown in area 603 .
  • the difference data about version 3 includes the logo of version 3, the logo of the student table (ie: E01), the type of difference (ie: CHANGE) and the attributes of the student table.
  • the structured data of version 4 includes the following two differences: 1 change the table name of the teacher table from "teacher” to "db_teacher", as shown in area 604; 2Delete the student table, as shown in area 605.
  • the difference data about version 4 includes the identification of version 4, the identification of the teacher table and the student table (respectively E01, E02), the difference type, and the attributes of the teacher table and the student table.
  • a new class table is added in the structured data of version 5, and the difference between version 5 and version 5 is shown in area 606 .
  • the difference data about version 5 includes the mark of version 4, the mark of class table (being respectively E03), difference type and the attribute of class table.
  • Fig. 6 and Fig. 7 take the module of table as an example for illustration, and it is not intended to limit that this solution is only applicable to tables, and it is also applicable to other elements such as fields.
  • the previous version data may be default data or blank data.
  • the server may obtain the default data through pre-configuration, pre-setting, or receiving user input.
  • the server can record the changes of different versions of structured data by way of incremental storage, realizing the change record of structured data.
  • users can easily view the direct iterative changes of different versions, which is convenient for users to perform version retrospection and meets the visualization needs of structured data changes.
  • the server records structured data of different versions, there is no need to record the entire structured data, which reduces the amount of records.
  • FIG. 8 is a schematic flowchart of another possible version method provided by the embodiment of the present application.
  • the method may apply the database design system shown in FIG. 2 . It should be understood that, for the convenience of description, the present application uses the sequence shown in FIG. 8 for description, and is not intended to limit execution to be performed in the above sequence. There is no limitation on the execution sequence, execution time, and execution times of the above one or more steps.
  • the method embodiment shown in FIG. 8 may include some or all of the steps in step S801-step S803.
  • step S801-step S803 reference may be made to step S301-step S303. I won't go into details here.
  • step S804 may include step S804, specifically as follows:
  • Step S804 the server receives first request information from the user equipment.
  • the first request information is used to request the structured data of the first version.
  • a user device when a user device opens a certain interface, it acquires the latest version of structured data by default, and the first version is the latest version.
  • the user equipment when opening a certain interface, the user equipment may send the first request information to the server, so as to request to view the structured data of the first version.
  • the server receives the first request information from the user equipment.
  • the user equipment may display one or more versions of information to the user, and the user equipment receives a selection operation for the first version input by the user, so as to send the first request information to the server.
  • the server receives the first request information from the user equipment.
  • FIG. 9 is a schematic diagram of possible multiple versions of information provided by an embodiment of the present application.
  • Area 901 displays information of three versions, namely version 5, version 4 and version 3.
  • “Submitter” is the user who submitted that version of the Structured Data.
  • “Creation time” indicates the time when the structured data of this version was submitted, or the time when the structured data of this version was formed.
  • “Action” is used to indicate the action that can be performed on this version of structured data.
  • the components shown in area 902 are used for the rollback version, or are used to indicate an interface that presents the rollback version.
  • the current version is version 5, and the user can roll back to version 3 by clicking the rollback button corresponding to version 3.
  • the components shown in area 903 are used to view one or more versions or indicate to view structured data of a specified version. For example, clicking on a component shown in area 903 may present version 5 structured data.
  • the component shown in area 904 is used to view the process information of a specified version, for example, view the review process information of version 5.
  • the review process information may include one or more items of the reviewer, the change difference visualization, or the database schema definition language (Data Definition Language. DDL).
  • the interface shown in FIG. 9 may be presented by the user equipment.
  • the user may select a certain version according to his or her own needs, and the service user equipment receives a selection operation for the first version input by the user, and the operation indicates to view the structured data of the first version.
  • the user equipment sends the first request information to the server, requesting the structured data of the first version.
  • the embodiment shown in FIG. 8 includes at least step S805, specifically as follows:
  • Step S805 The server obtains the structured data of the first version according to the difference data about the first version and the difference data about the versions before the first version.
  • the difference data can reflect the difference between the current version and the previous version. Therefore, the difference data of the first version, as well as the difference data about the versions before the first version, can obtain the structured data of the first version.
  • the server determines, among the total difference data, difference data about the first version and difference data about versions prior to the first version.
  • the server performs deduplication operations in order from newest to oldest to obtain the full amount of elements in the current version.
  • the difference data of the latest version of an element with a certain ID can be retained, and the element whose operation type includes "delete” (or "DROP") can be removed.
  • the server needs to obtain structured data of version 5.
  • the server first determines the difference data about version 5, and the difference data about version 4, version 3, version 2 and version 1, and performs the deduplication operation according to the versions from newest to old.
  • the element whose ID is "E03" is reserved as an element in the structured data of version 5.
  • the element with ID "E02” does not contain the element with ID "E02" in the structured data of version 5 because its operation type contains "DROP". .
  • the element with the ID "E01” is the latest version of the difference data about version 4, so the structured data of version 5 contains the element with the ID "E01” .
  • the attribute and value of the element with the ID "E01” in version 5 are: the table name is "db_teacher”, and the comment is "teacher table”.
  • the server needs to obtain structured data of version 1.
  • the server first determines the difference data about version 1, and there is no corresponding version before version 1, so the server obtains the structured data of version 1 according to the difference data of version 1.
  • the element with the ID "E01" shown in the first line of Figure 7 is reserved as an element in the structured data of version 1; the element with the ID "E02" shown in the second line of Figure 7 is also reserved as the Elements in version 1 structured data.
  • the server may send the structured data of the first version to the user equipment.
  • the user equipment may receive the structured data of the first version, so as to present the structured data of the first version.
  • the server can obtain the structured data of the previous version according to the difference data about the versions before the first version. Further, the server may obtain the structured data of the first version according to the difference data about the first version and the structured data of the previous version.
  • the server can obtain different versions of structured data according to one or more versions of difference data.
  • the server can provide structured data corresponding to different versions in response to requirements, satisfying viewing requirements for structured data of different versions, and improving user experience.
  • the server may satisfy the user's vertical backtracking requirement based on the above difference data.
  • FIG. 10 is a schematic flowchart of another possible version method provided by the embodiment of the present application.
  • the method may apply the database design system shown in FIG. 2 . It should be understood that, for the convenience of description, the present application uses the sequence shown in FIG. 10 for description, and is not intended to limit execution to be performed in the above sequence. There is no limitation on the execution sequence, execution time, and execution times of the above one or more steps.
  • the method embodiment shown in FIG. 10 may include some or all of the steps in step S1001-step S1003.
  • step S1001-step S1003 reference may be made to step S301-step S303. I won't go into details here.
  • step S1004 may include step S1004, specifically as follows:
  • Step S1004 the server receives the second request information from the user equipment.
  • the second request information is used to request the change record of the first element.
  • the change record can also be called the life cycle of the first element, or historical information, etc.
  • the first element is at least one element among one or more elements indicated by the structured data.
  • the database model data may contain attributes of one or more elements, such as attributes of one or more tables, or attributes of one or more fields. Users can view the change records of one (or several) elements.
  • the change record can view the creation, modification and other records of the element.
  • the embodiment shown in Figure 10 includes at least step S1005, specifically as follows:
  • Step S1005 The server obtains the change record of the first element according to the difference data about the first version, the difference data about the version before the first version, and the information about the first element.
  • the server needs to obtain the change record of the element whose ID is "E01”, it can determine that the ID is "E01" in the difference data shown in Figure 7
  • the difference data corresponding to the element of " which can be specifically the data corresponding to the 2nd row, the 3rd row, and the 5th row. It can be seen that the difference data corresponding to the element "E01" reflects the creation and modification process.
  • the server may use the difference data corresponding to the first element as a change record of the first element.
  • the server may further process the difference data corresponding to the first element to obtain a change record of the first element.
  • the server may feed back the change record of the first element to the user.
  • the server may send the change record of the first element to the user equipment, and correspondingly, the user equipment receives the change record of the first element, so as to present the change record of the first element.
  • the server can realize the vertical backtracking of elements according to the difference data, so that users can know in which version table A was created and updated, and intuitively obtain the life cycle of elements , which improves the user experience.
  • FIG. 11 is a schematic structural diagram of a version management device 110 provided by an embodiment of the present application.
  • the version management device 110 can be a server or user equipment, or a device in the server or user equipment, such as a chip , software modules, integrated circuits, etc.
  • the version management apparatus 110 is used to implement the aforementioned version management method, for example, the version management method in the embodiment shown in FIG. 3 , FIG. 8 or FIG. 10 .
  • the version management apparatus 110 may include an obtaining unit 1101 and a processing unit 1102 .
  • the above-mentioned version management apparatus 110 may be the server in the foregoing embodiments.
  • the acquiring unit 1101 is configured to acquire structured data of a first version, where the structured data includes attributes of elements and values corresponding to the attributes;
  • the processing unit 1102 is configured to obtain, according to the structured data of the first version and the structured data of a previous version, difference data about the first version, where the difference data about the first version characterizes the The difference between the structured data of the first version and the structured data of the previous version, where the difference data about the first version includes the identifier of the first version, the identifier of the changed element and the change operation type ;
  • the processing unit 1102 is further configured to record the difference data corresponding to the first version.
  • the structured data includes one or more modules, and each module includes attributes of some elements and values corresponding to the attributes of the elements;
  • the processing unit 1102 is further configured to:
  • the difference data includes corresponding to the one or more Difference data for each module.
  • the processing unit 1102 may perform deduplication operations in order of versions from newest to oldest, to obtain all elements of the current version.
  • the processing unit 1102 when it performs the deduplication operation, it may retain the latest version difference data of an element with a certain ID, and remove the element whose operation type includes "delete” (ie: "DROP").
  • the acquiring unit 1101 is further configured to receive first request information from a user equipment, where the first request information is used to request the structured data of the first version;
  • the processing unit 1102 is further configured to obtain the structured data of the first version according to the difference data about the first version and the difference data about a version before the first version.
  • the acquiring unit 1101 is further configured to receive second request information from the user equipment, where the second request information is used to request a change record of the first element, and the first element belonging to said one or more elements;
  • the processing unit 1102 is further configured to obtain a change record of the first element according to the difference data about the first version, the difference data about a version before the first version, and the information about the first element .
  • the change operation type includes one or more of adding, deleting, or updating.
  • the structured data includes one or more items of database model data, JSON data, or Extensible Markup Language XML data.
  • the structured data includes database model data
  • the one or more elements include one or more of the following element types: tables, fields, indexes, views, or relationships .
  • FIG. 12 is a schematic structural diagram of a computing device 120 provided by an embodiment of the present application.
  • the computing device 120 may be an independent device (such as one or more of a server, or a user device, etc.), or may be It is an internal component of an independent device (such as a chip, a software module or a hardware module, etc.).
  • the computing device 120 may include at least one processor 1201 .
  • at least one memory 1203 may also be included.
  • the computing device 120 may further include a communication interface 1202 .
  • a bus 1204 may also be included, wherein the processor 1201 , the communication interface 1202 and the memory 1203 are connected through the bus 1204 .
  • the processor 1201 is a module for performing arithmetic operations and/or logic operations, specifically, a central processing unit (central processing unit, CPU), a picture processing unit (graphics processing unit, GPU), a microprocessor (microprocessor unit, MPU) ), Application Specific Integrated Circuit (ASIC), Field Programmable Logic Gate Array (Field Programmable Gate Array, FPGA), Complex Programmable Logic Device (Complex programmable logic device, CPLD), coprocessor (assisting central processing One or more combinations of processing modules such as processors to complete corresponding processing and applications), Microcontroller Unit (MCU) and other processing modules.
  • a central processing unit central processing unit, CPU
  • a picture processing unit graphics processing unit, GPU
  • microprocessor microprocessor unit, MPU
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • FPGA Field Programmable Gate Array
  • CPLD Complex Programmable Logic Device
  • coprocessor assisting central processing
  • MCU Microcontroller Unit
  • Communication interface 1202 may be used to provide information input or output to the at least one processor. And/or, the communication interface 1202 can be used to receive data sent from the outside and/or send data to the outside, and can be a wired link interface such as an Ethernet cable, or a wireless link (Wi-Fi, Bluetooth, general wireless transmission, vehicle short-range communication technology and other short-range wireless communication technologies, etc.) interface. Optionally, the communication interface 1202 may also include a transmitter (such as a radio frequency transmitter, an antenna, etc.) or a receiver coupled with the interface.
  • a transmitter such as a radio frequency transmitter, an antenna, etc.
  • the memory 1203 is used to provide a recording space, in which data such as operating systems and computer programs can be recorded.
  • Memory 1203 can be random access memory (random access memory, RAM), read-only memory (read-only memory, ROM), erasable programmable read-only memory (erasable programmable read only memory, EPROM), or portable read-only memory One or more combinations of memory (compact disc read-only memory, CD-ROM), etc.
  • At least one processor 1201 in the computing device 120 is configured to execute the aforementioned version management method, for example, the version management method described in the embodiment shown in FIG. 3 , FIG. 8 or FIG. 10 .
  • the processor 1201 may be a processor dedicated to executing these methods (referred to as a dedicated processor for convenience), or a processor that executes these methods by invoking computer programs, such as a general-purpose processor.
  • at least one processor may also include both a special-purpose processor and a general-purpose processor.
  • the above computer programs may be stored in the memory 1203 .
  • the foregoing computing device 120 may be the server in the foregoing embodiments.
  • At least one processor 1201 in the computing device 120 is configured to execute calling computer instructions to perform the following operations:
  • the difference data about the first version is obtained, and the difference data about the first version represents the difference between the structured data of the first version and the structured data of the previous version.
  • the difference between the structured data of the previous version, the difference data about the first version includes the identifier of the first version, the identifier of the changed element and the change operation type;
  • the structured data includes one or more modules, and each module includes attributes of some elements and values corresponding to the attributes of the elements;
  • the processor 1201 is further configured to:
  • the difference data includes corresponding to the one or more Difference data for each module.
  • the processor 1201 may perform deduplication operations in order of versions from newest to oldest, to obtain all elements of the current version.
  • the processor 1201 when the processor 1201 performs the deduplication operation, it may retain the latest version difference data of an element with a certain ID, and remove the element whose operation type includes "delete” (that is, "DROP").
  • the processor 1201 is further configured to:
  • the structured data of the first version is obtained from the difference data about the first version and the difference data about a version before the first version.
  • the processor 1201 is further configured to:
  • a change record of the first element is obtained according to the difference data about the first version, the difference data about a version before the first version, and the information about the first element.
  • the change operation type includes one or more of adding, deleting, or updating.
  • the structured data includes one or more items of database model data, JSON data, or Extensible Markup Language XML data.
  • the structured data includes database model data
  • the one or more elements include one or more of the following element types: tables, fields, indexes, views, or relationships .
  • the present application also provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on at least one processor, the aforementioned version management method is implemented, such as FIG. 3, The version management method shown in FIG. 8 or FIG. 10 .
  • the present application also provides a computer program product, which includes computer instructions, and when executed by a computing device, realizes the aforementioned version management method, such as the version management method shown in FIG. 3 , FIG. 8 or FIG. 10 .
  • words such as “exemplary” or “for example” are used as examples, illustrations or descriptions. Any embodiment or design described herein as “exemplary” or “for example” is not to be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as “exemplary” or “such as” is intended to present related concepts in a concrete manner.
  • At least one refers to one or more, and the “multiple” refers to two or more.
  • At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items.
  • at least one item (piece) of a, b, or c may represent: a, b, c, (a and b), (a and c), (b and c), or (a and b and c), where a, b, c can be single or multiple.
  • first and second use ordinal numerals such as "first" and “second” to distinguish multiple objects, and are not used to limit the order, timing, priority or importance of multiple objects degree.
  • first user equipment and the second user equipment are only for the convenience of description, and do not represent the differences in structure, importance, etc. between the first user equipment and the second user equipment.
  • the first user equipment The device and the second user device may also be the same device.

Landscapes

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

Abstract

本申请实施例提供一种结构化数据的版本管理方法、装置及相关设备,应用于信息技术IT领域。该方法包括:获取第一版本的结构化数据,结构化数据包含一个或者多个元素的属性以及属性对应的值;根据第一版本的结构化数据和上一个版本的结构化数据,得到关于第一版本的差异数据,该差异数据表征第一版本的结构化数据与上一个版本的结构化数据之间的差异;记录对应所述第一版本的所述差异数据。本申请实施例中,通过增量存储方式,能够记录结构化数据的变更,使得用户可以便捷地查看到不同版本直接的迭代变化。

Description

结构化数据的版本管理方法、装置及相关设备
本申请要求于2021年09月29日提交中国专利局、申请号为202111154746.4、申请名称为“结构化数据的版本管理方法、装置及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据库技术领域,尤其涉及结构化数据的版本管理方法、装置及相关设备。
背景技术
数据库的设计部署过程中,随着业务调整、需求变更,通常需要对数据库进行多次修改、版本迭代才能设计完成。因此对于数据库模型的版本进行管理,可以便于回溯修改。但是目前的数据库设计软件,在修改数据库模型结构后,无法提供回溯功能。一些场景中,通过代码仓,可以对数据库模型的脚本文件进行版本管理。但是代码仓只能记录代码、数据的修改,而数据库的各个元素之间的依赖关系往往较为复杂,通过记录脚本文件难以对数据库模型的版本进行回溯,非结构化的文本也不利于用户查看数据库结构的修改,用户体验较差。
因此,如何解决上述问题,是本领域人员正在研究的热点。
发明内容
本申请实施例提供了结构化数据的版本管理方法、装置及相关设备,能够记录结构化数据的变更,使得用户可以便捷地查看到不同版本直接的迭代变化。
第一方面,本申请实施例提供了一种结构化数据的版本管理方法,包括:
获取第一版本的结构化数据,所述结构化数据包含元素的属性以及所述属性对应的值;
根据所述第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,所述关于第一版本的差异数据表征所述第一版本的结构化数据与所述上一个版本的结构化数据之间的差异,所述关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识以及变更操作类型;
记录关于所述第一版本的所述差异数据。
可选的,上述方法可以应用于服务器,由服务器或者服务器内部的部件(例如芯片、软件模块或集成电路)来执行。或者上述方法可以应用于数据库设计系统,例如由数据库设计系统的服务端来执行。
本申请实施例中,通过增量存储方式,来记录不同版本的结构化数据的变更,实现了对于结构化数据的变更记录。一方面,用户可以便捷地查看到不同版本直接的迭代变化,方便用户进行版本回溯,满足了对结构化数据变更的可视化需求。另一方面,服务器记录不同版本地结构化数据时,无需记录整个结构化数据,降低了记录量。
此外,通过本申请实施例可以便捷、高效地实现横向回溯和纵向回溯,在横向回溯某一版本时,可以根据差异数据便捷地计算该版本的元素,查询速度快、效率高。通过本申请实施例,根据元素的标识以及差异数据,即可了解该解元素的生命周期,查询速度快、效率高。
在第一方面的一种可能的实施方式中,所述结构化数据包含数据库模型数据、JSON数据、或可扩展标记语言(extensible markup language,XML)数据中的一项或者多项。
其中,数据库模型数据可以包含表、字段、视图等元素,上述元素可以分别对应一个或者多个属性。通过本申请实施例的方法,可以对数据库模型数据进行增量存储,具有数据存储容量少,存储速度快,查询速度快等优点。
JavaScript对象简谱((JavaScript object notation,JSON)数据,通常可以用于表示一个或者多个对象或者对象数组。在JSON数据中,通常来说,对象由“花括号”括起来部分构成,每个对象通常包含一个或者多个属性以及属性对应的值构成,不同属性之间通过“,”分隔。应理解,JSON数据中的对象可以看作元素。
XML数据中可以包含一个或者多个节点。该节点可以看作XML数据的元素。
在第一方面的又一种可能的实施方式中,所述结构化数据包含一个或者多个模块;所述根据第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,包括:
将所述第一版本的结构化数据和所述上一个版本的结构化数据,按模块进行比较,得到所述关于所述第一版本的差异数据,所述差异数据包含对应所述一个或者多个模块的差异数据。
可选的,在进行去重时,可以按照版本从新到旧的顺序,进行去重操作,得到当前版本的全量元素。
可选的,进行去重操作时,保留某一ID的元素的最新版本的差异数据、以及去掉操作类型包含“删除”(即:“DROP”)的元素。
在第一方面的又一种可能的实施方式中,所述方法还包括:
接收来自用户设备的第一请求信息,所述第一请求信息用于请求所述第一版本的结构化数据;
根据关于所述第一版本的差异数据以及关于所述第一版本之前的版本的差异数据,得到所述第一版本的结构化数据。
在第一方面的又一种可能的实施方式中,所述方法还包括:
接收来自用户设备的第二请求信息,所述第二请求信息用于请求第一元素的变更记录,所述第一元素属于上述元素;
根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述第一元素的信息,得到所述第一元素的变更记录。
在第一方面的又一种可能的实施方式中,所述变更操作类型包含添加、删除或更新等中的一项或者多项。
在第一方面的又一种可能的实施方式中,所述结构化数据包含数据库模型数据、JASON数据、或可扩展标记语言XML数据中的一项或者多项。
在第一方面的又一种可能的实施方式中,所述结构化数据包含数据库模型数据,所述元素包含属于以下元素种类中的一种或者多种:表、字段、索引、视图、或关系。
第二方面,本申请实施例提供一种版本管理装置,该版本管理装置包括获取单元和处理单元,该版本管理装置用于实现第一方面或第一方面任一种可能的实施方式所描述的方法。
在第二方面的一种可能的实施方式中,所述获取单元,用于获取第一版本的结构化数据,所述结构化数据包含元素的属性以及所述属性对应的值;
所述处理单元,用于根据所述第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,所述关于第一版本的差异数据表征所述第一版本的结构化数 据与所述上一个版本的结构化数据之间的差异,所述关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识以及变更操作类型;
所述处理单元,还用于记录对应所述第一版本的所述差异数据。
在第二方面的又一种可能的实施方式中,所述结构化数据包含一个或者多个模块,每一个模块包含部分元素的属性和所述部分元素的属性对应的值;
所述处理单元,还用于:
将所述第一版本的结构化数据和所述上一个版本的结构化数据,按模块进行比较,得到所述关于所述第一版本的差异数据,所述差异数据包含对应所述一个或者多个模块的差异数据。
可选的,在进行去重时,处理单元可以按照版本从新到旧的顺序,进行去重操作,得到当前版本的全量元素。
可选的,处理单元进行去重操作时,可以保留某一ID的元素的最新版本的差异数据、以及去掉操作类型包含“删除”(即:“DROP”)的元素。
在第二方面的又一种可能的实施方式中,所述获取单元,还用于接收来自用户设备的第一请求信息,所述第一请求信息用于请求所述第一版本的结构化数据;
所述处理单元,还用于根据关于所述第一版本的差异数据以及关于所述第一版本之前的版本的差异数据,得到所述第一版本的结构化数据。
在第二方面的又一种可能的实施方式中,所述获取单元,还用于接收来自用户设备的第二请求信息,所述第二请求信息用于请求第一元素的变更记录,所述第一元素属于所述一个或者多个元素;
所述处理单元,还用于根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述第一元素的信息,得到所述第一元素的变更记录。
在第二方面的又一种可能的实施方式中,所述变更操作类型包含添加、删除或更新等中的一项或者多项。
在第二方面的又一种可能的实施方式中,所述结构化数据包含数据库模型数据、JSON数据、或可扩展标记语言XML数据中的一项或者多项。
在第二方面的又一种可能的实施方式中,所述结构化数据包含数据库模型数据,所述一个或者多个元素包含属于以下元素种类中的一种或者多种:表、字段、索引、视图、或关系。
第三方面,本申请实施例提供一种计算设备,该计算设备包括处理器和存储器;存储器中存储有计算机程序;处理器执行计算机程序时,计算设备执行前述第一至四方面任一项所描述的方法。
需要说明的是,上述第十一方面所描述的数据传输装置所包含的处理器,可以是专门用于执行这些方法的处理器(便于区别称为专用处理器),也可以是通过调用计算机程序来执行这些方法的处理器,例如通用处理器。可选的,至少一个处理器还可以既包括专用处理器也包括通用处理器。
可选的,上述计算机程序可以存在存储器中。示例性的,存储器可以为非瞬时性(non-transitory)存储器,例如只读存储器(Read Only Memory,ROM),其可以与处理器集成在同一块器件上,也可以分别设置在不同的器件上,本申请实施例对存储器的类型以及存储器与处理器的设置方式不做限定。
在一种可能的实施方式中,上述至少一个存储器位于上述计算设备之外。
在又一种可能的实施方式中,上述至少一个存储器位于上述计算设备之内。
在又一种可能的实施方式之中,上述至少一个存储器的部分存储器位于上述计算设备之内,另一部分存储器位于上述计算设备之外。
本申请中,处理器和存储器还可能集成于一个器件中,即处理器和存储器还可以被集成在一起。
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在至少一个处理器上运行时,实现前述第一至四方面任一项所描述的方法。
第五方面,本申请提供了一种计算机程序产品,计算机程序产品包括计算机指令,当所述指令在至少一个处理器上运行时,实现前述第一至四方面任一项所描述的方法。
可选的,该计算机程序产品可以为一个软件安装包,在需要使用前述方法的情况下,可以下载该计算机程序产品并在计算设备上执行该计算机程序产品。
本申请第二至第五方面所提供的技术方案,其有益效果可以参考第一方面的技术方案的有益效果,此处不再赘述。
附图说明
下面将对实施例描述中所需要使用的附图作简单的介绍。
图1是本申请实施例提供的一种数据库模型的变更示意图;
图2是本申请实施例提供的一种数据库设计系统的架构示意图;
图3是本申请实施例提供的一种版本管理方法的流程示意图;
图4是本申请实施例提供的一种JSON数据的示意图;
图5是本申请实施例提供的一些可能的差异数据的结构示意图;
图6是本申请实施例提供的一种多个版本的结构化数据的示意图;
图7是本申请实施例提供的一种关于多个版本的差异数据的示意图;
图8是本申请实施例提供的又一种版本管理方法的流程示意图;
图9是本申请实施例提供的一种多个版本的信息的示意图;
图10是本申请实施例提供的又一种版本管理方法的流程示意图;
图11是本申请实施例提供的一种版本管理装置的结构示意图;
图12是本申请实施例提供的一种计算设备的结构示意图。
具体实施方式
下面结合附图对本申请实施例进行详细介绍。
为了便于理解,以下示意性地给出了部分与本申请实施例相关概念的说明以供参考。
1.数据库、表、字段
数据库(database,DB)是按照数据结构来组织、记录和管理数据的仓库,是一个记录在计算机内的有组织的、可共享的大量数据的集合。
表可以记录特定类型的数据,例如学生信息、院系目录等。每个表都有一个表ID、表名、注释等属性。
表包括一个或者多个列(column),每列是表中的一个字段,每列中记录着表中某部分的信息。例如数据库中可以包含表名为“学生”的表,一个列记录学生的学号(studentidentification,或称为,学生ID),一个列记录学生的名字(name)。字段可以包含字段名称、字段类型等属 性。
其中,数据库的库、表、字段等都可以看作是数据库中的元素。当然,数据库中的元素还可以包含索引、视图、关系等元素,此处不再一一介绍。
2.数据库设计系统
数据库设计系统是一种可视化的数据库设计与管理的工具,用于设计、建立、使用和维护数据库。用户可以在数据库设计系统中创建(或编辑)包括元素以及元素之间关联关系的设计视图,数据库设计系统能够记录用户创建(或编辑)的数据库设计视图,并可以建立数据库的模型(或者还包括记录数据库的数据)。
应理解,本申请中的用户可以包含数据库设计系统的用户,包括数据库设计系统的使用者、管理者、设计者或开发者等。
3.版本管理、横向回溯、纵向回溯
版本管理是指对开发过程中代码、文档、模型设计等数据变更的管理,是开发迭代中过程管理的核心思想之一。
在管理的多个版本中,随意选取任意一个历史版本,获取该版本的全量数据,为横向回溯。
在被管理的多个对象(可以是任一版本中的对象)中,随意选取某一个对象,获取对象(及该对象的子对象)在整个版本管理生命周期内的变更情况,为纵向回溯。
上述对概念的示例性说明可以应用在下文的实施例中。
结构化的数据中包含元素的属性以及属性对应的值,通过基于文本、字符串等的版本管理方法难以记录结构化数据的变更,用户对结构化数据进行迭代时,难以进行回溯,体验较差。例如,数据库模型数据是结构化的数据,一个数据库(或数据库模型)中存在一个或多个元素,元素又可以包含属性、或子属性等,甚至元素与元素之间还有关联关系。若基于文本、字符串等的版本管理方法进行版本管理,不同版本的数据库(或数据库模型)进行差异对比时,看到的将是错乱的文本块,难以直观理解其差异,体验较差。
此外,如JSON数据、XML数据等结构化的数据都面临版本管理的问题。
请参见图1,如图1所示是本申请实施例提供的一种可能的数据库模型的示意图。如图1的(a)部分所示有所示为学生数据库模型,在一个设计阶段,学生数据库中添加了学生表(student)和教师表(teacher),分别对应学生实体和教师实体。其中,学生表(学生实体)可以包含以下字段(属性):学号工号(sutdent_ID)、班级号(class_ID)、开始日期(date),教师表(教师实体)可以包含以下字段(属性):教师工号(teacher_ID)、姓名(teacher_name)、性别(sex)、和入职时间(hiredate)。
在数据库设计过程中,对于数据库的需求可能随时会变更,因此会对数据库模型进行修改。例如,如图1的(b)部分所示,当前设计阶段,需要新增加一个班级实体,使得学生可以查看自己班级对应的教师。班级表(班级实体)可以包含以下字段(属性):班级号(class_ID)、班级名(class_name)、教师姓名(teacher_name)。其中,班级表中的班级号与学生表中的学生号关联,班级表中的教师名称与教师表中的姓名关联。
再如,在数据库中更新表的属性(例如修改表名、或注释等)、更新字段的属性(例如修改字段名称、修改字段类型)、更新视图、更新函数等。
如上所示的对数据库模型的变更可能会在数据库设计过程中发生多次,因此,需要对数据库模型的版本进行管理,便于回溯修改。但是目前的数据库设计软件,在修改数据库模型 结构后,无法提供回溯功能。即便通过文本对比记录修改,非结构化的文本也不利于用户查看数据库结构的修改,用户体验较差。
为了解决上述问题,本申请实施例提供一种结构化数据的版本管理方法、装置及相关设备,能够记录结构化数据的变更,使得用户可以便捷地查看到不同版本直接的迭代变化。
以下以结构化数据为数据库模型数据为例,对本身申请实施例的架构进行描述。本领域技术人员应当理解,对于其他形式的结构化数据,其版本管理的系统架构可以参考下面的结构。
本申请实施例提供的版本管理方法可以基于数据库设计系统来实现,也可以基于其他可以设计、创建、编辑数据库模型数据的系统、设备来实现。其中,数据库设计系统可以包含硬件模块、或软件模块(如应用程序、组件等)、或硬件模块与软件模块的组合等。
一种可能的设计中,数据库设计系统可以包括客户端和服务端。客户端可以用于呈现界面、选择框、输入框等与用户交互的组件,服务端用于向客户端提供数据库模型的结构化数据、或响应用户的请求等。
请参见图2,图2是本申请实施例提供的一种可能的数据库设计系统的架构示意图。如图2所示的系统包括至少一个用户设备201和至少一个服务器202。
其中,用户设备201是具有数据处理、数据收发能力的电子设备,可以实现前述客户端的功能。例如可以包括手持终端、可穿戴设备、车辆、机器人等独立设备,也可以是包含在独立设备中的部件(例如芯片或集成电路)。示例性地,当终端装置为手持终端时,可以是手机(mobile phone)、平板电脑(pad)、电脑(如笔记本电脑、掌上电脑等)等。
服务器202是具有数据处理、数据收发能力的装置,可以实现前述服务端的功能。应理解,此处便于描述称为服务器,其具体形式可以为实体装置如服务器、或主机等,也可以是虚拟装置如虚拟机、或容器等。可选的,服务器202可以独立的部署在一个设备中,也可以分布式的部署在多个设备上。
服务器202可以接收创建数据库的请求、修改数据库的请求等,在变更数据库时,服务器可以通过该次修改的数据库模型数据与当前记录的数据库模型数据,记录两个版本的差异数据,实现对结构化数据的变更的管理。而且,无需每次记录整个数据库,减少存储量。
如此,通过记录差异数据,在横向回溯时,可以根据一个或者多个版本的差异数据得到某一版本的数据库;在纵向回溯时,通过回溯对某一元素的创建、修改、或删除等操作,可以纵向查看某一元素的生命周期。用户可以便捷地横向回溯和纵向回溯,提升用户的使用体验。
应理解,上述服务器202与用户设备201之间通信的链路可以是有线链路、无线链路或者有线链路与无线链路的组合等方式。进一步可选的,通信还可以通过一种或者多种网络技术实现。本申请对于服务器与用户设备201之间的通信方式不做限定。
在一种可能的设计中,如图2所示的服务器202可以为云平台。其中,云平台包含云服务提供商提供的大量基础资源(包括但不限于计算资源、记录资源、或网络资源等),其中计算资源可以是大量的计算设备(例如服务器、虚拟机)。
在一种可能的实施场景中,上述数据库设计系统能够由云服务提供商在云平台抽象成一种数据库设计的云服务提供给用户。例如,用户购买数据库设计云服务之后,云平台响应于用户触发的数据库设计系统实例创建操作,在云服务提供商提供的资源上创建数据库设计系统实例,然后向用户提供数据库模型的版本管理服务。相应的,用户所使用的用户设备可以呈现界面、使用版本管理服务。
其中,购买数据库设计云服务的方式可以包括:先预充值再根据最终资源的实际使用情况进行结算,或者,按使用云服务的时间或者按照购买的云服务的功能或资源结算。
需要说明的是,在本申请实施例中,云平台可以是中心云的云平台、边缘云的云平台或包括中心云和边缘云的云平台,本申请实施例对其不做具体限定。并且,当云平台为包括中心云和边缘云的云平台时,该数据库设计系统可以部分部署在边缘云的云平台中,部分部署在中心云的云平台中。
下面对本申请实施例的方法进行详细介绍。
请参见图3,图3是本申请实施例提供的一种版本管理方法的流程示意图。可选的,该方法可以应用于前述的版本管理系统,例如图2所示的数据库设计系统。
如图3所示的版本管理方法至少包括步骤S301至步骤S302。应理解,本申请为了方便描述,故通过S301至S302这一顺序进行描述,并不旨在限定一定通过上述顺序进行执行。本申请实施例对于上述一个或多个步骤的执行的先后顺序、执行的时间、执行的次数等不做限定。步骤S301至步骤S302具体如下:
步骤S301:服务器获取第一版本的结构化数据。
其中,服务器是具有数据处理功能的装置。此处为了便于描述故称为服务器,并不限定本方法一定通过服务器来实现,例如还可以通过虚拟机、或主机等实现。
其中,结构化数据是具有相对固定的模式的数据。结构化数据包含元素的属性以及包含属性对应的值。结构化数据中的属性可以是一个,也可以是多个。部分场景下,某一版本的机构化数据还可以是空数据,即,不包含元素的属性。
结构化数据中的属性与一个或者多个元素(或称为对象)相关,该属性为结构化数据所指示的一个或者多个元素(或称为对象)的属性。例如,结构化数据中的属性可以包含表的名称、表的注释、字段的名称、字段的字段类型等属性,其中的表、字段等即为元素(或称为对象)。
一种设计中,结构化数据可以通过键值(key-value)来获取相应的信息。
可选的,结构化数据的种类可以属于数据库模型数据、JavaScript对象简谱((JavaScript object notation,JSON)数据、或可扩展标记语言(extensible markup language,XML)数据中的一项或者多项。
其中,数据库模型数据可以包含表、字段、视图等元素,上述元素可以分别对应一个或者多个属性。通过本申请实施例的方法,可以对数据库模型数据进行增量存储,具有数据存储容量少,存储速度快,查询速度快等优点。JSON数据,通常可以用于表示一个或者多个对象或者对象数组。在JSON数据中,通常来说,对象由“花括号”括起来部分构成,每个对象通常包含一个或者多个属性以及属性对应的值构成,不同属性之间通过“,”分隔。应理解,JSON数据中的对象可以看作元素。XML数据中可以包含一个或者多个节点。该节点可以看作XML数据的元素。
例如,请参见图1的(b)部分所示,数据库模型数据包含多个表,每一个表对应一种实体。表表可以包含多个属性,例如表名、字段等一个或者多个属性。表中的字段也可以看作一种元素,字段也可以包含多个属性,例如字段名称、数据格式、字段ID等属性。
再如,请参见图4,图4是本申请实施例提供的一种可能的JSON数据的结构示意图。可以看出,JSON格式中一个对象可以包含多个属性,例如,表名为“tb_teacher”的这个对象可以包含表名、注释、表ID、字段等多个属性。可选的,字段属性的值可以是包含多个对象 的数组,数组中的每一个对象又分别再包含多个属性。具体不再一一介绍。
可选的,服务器可以接收来自其他设备的第一版本的结构化数据,从而获取第一版本的结构化数据。例如,用户可以在用户设备中创建、编辑或删除结构化数据中的一个或者多个元素、或者编辑元素的属性等,从而得到不同版本的结构化数据。用户在用户设备中保存或者提交第一版本的结构化数据,相应的,服务器可以接收来自用户设备的第一版本的结构化数据。
或者可选的,服务器可以自己生成第一版本的结构化数据。例如,用户可以通过指示信息指示其对结构化数据的修改,服务器基于原本的结构化数据和指示信息,生成第一版本的结构化数据。
步骤S302:服务器根据第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据。
其中,所述上一个版本指服务器中记录的第一版本的之前的一个版本。而第一版本的差异数据表征所述第一版本的结构化数据与所述上一个版本的结构化数据之间的差异。
关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识、以及变更操作类型。其中,第一版本的标识也可以称为版本号,或版本信息。例如,第一版本可以是第二次修改该结构化数据,则第一版本的标识可以为“版本(version,或ver.)2”。存在变更的元素例如可以是如图1所示的表、或字段等,或者例如图4所示的表名为“tb_teacher”对象等。元素的标识用于指示元素,例如,可以包含元素ID、编号等中一项或者多项。变更操作类型包含添加、删除、或更新等中的一个或者多个操作类型。进一步的,还可以包含增加、删除或者修改元素对应的属性。
以图1为例,相比上一个版本,用户在第一版本中增加了班级表,则差异数据中包含第一版本的版本号、班级表的ID、变更的操作(即增加)。进一步的,用户在第一版本中增加了班级表的字段,即:班级号、班级名和教师姓名字段,则差异数据中还包含第一版本的版本号、以及班级号、班级名和教师姓名的ID、变更的操作(即:增加)。
为了便于理解,下面例举一种可能的第一版本的差异数据。请参见图5,图5是本申请实施例提供的一些可能的差异数据的结构示意图。请参见图5的(a)部分,差异数据包含版本标识(即:版本为“2”)、存在更改的元素的标识(即表ID为“E03”)、差异类型(即ACTION为“ADD”)。可选的,差异数据中还包含班级表的一个或者多个属性,例如名称、或注释等。
类似的,请参见图5的(b)部分所示,差异数据包含版本的标识、存在更改的元素的标识(即:字段ID分别为“E08、E09、E10”)、差异类型(即:ACTION为“ADD”)。可选的,差异数据中还包含上述元素的一个或者多个属性,例如字段名、或字段类型等。
可选的,结构化数据可以包含一个或者多个模块,每个模块包含结构化数据中的部分数据。服务器得到差异数据时,差异数据可以包含对应该一个或者多个模块的差异数据。
一种设计中,服务器将第一版本的结构化数据划分为一个或者多个模块。而上一个版本的结构化数据也包含多个模块。服务器将第一版本的结构化数据和当前版本的结构化数据,按模块进行比较,得到差异数据,差异数据包含对应一个或者多个模块的差异数据。
示例性地,如图1的(b)部分所示的结构化数据可以包含两个模块的数据(便于描述分别称为第一模块和第二模块)。其中,第一模块包含表相关的属性,例如学生表的属性(如表ID、表名、或注释等属性)、教师表的属性等。第二模块包含字段相关的属性,例如,教师工号字段相关的属性(如字段ID、字段名称、或字段类型等属性)、教师工号相关的属性等。而差异数据中包含对应第一模块的差异数据,例如图5的(a)部分。差异数据还包含对应第 二模块的差异数据,例如图5的(b)部分。
一种可能的实现方式中,模块可以是按照层级划分得到的。例如,上述一个或者多个模块中的每个模块对应结构化数据的一个(或者多个)层级。例如,数据库模型数据中表和字段分别为两个层级,因此,如图1的(b)部分所示的数据库模型数据可以划分得到两个模块。
又一种可能的实现方式中,模块可以是按照数组的层级划分得到的。例如,如图4所示的数据,其中表ID为E01的对象属于一个数组中的对象,因此属于一个模块。而表ID为E01的对象的字段属性的取值为另一个数组,因此可以将字段属性作为另一个模块。
可选的,上一个版本的结构化数据可以是根据关于第一版本之前的版本的差异数据得到的。
可选的,服务器在比较得到差异数据时,可以按照元素的标识进行比较,确定存在更改的元素的标识以及差异类型。例如,上一个版本的结构化版本数据中包含元素1的ID,但是第一版本的结构化数据中不包含元素1的ID,则元素1在第一版本对应的操作类型为删除(即:DROP)。类似的,上一个版本的结构化版本数据中不包含元素2的ID,但是第一版本的结构化数据包含元素2的ID,则元素2在第一版本对应的操作类型为新增(即:ADD)。
类似的,在上一个版本的结构化数据包含元素3的ID,而第一版本也包含元素3的ID,此时可以比较元素3对应的属性。若元素3在两个版本中存在不一致的属性,则元素3在第一版本对应的操作类型为修改(即:CHANGE);若元素3在两个版本中不存在不一致的属性,则元素3不存在更改,相应的,差异数据中不包含元素3对应的标识。
可选的,如图3所示的版本管理方法还包括步骤S303,具体如下:
步骤S303:服务器记录对应所述第一版本的所述差异数据。
例如,服务器记录该第一版本的差异数据。或者,服务器将关于第一版本的差异数据添加到总差异数据中,所述总差异数据包含关于一个或者多个版本的差异数据。
示例性的,请参见图6和图7,图6是本申请实施例提供的一种可能的多个版本的结构化数据的示意图,图7是本申请实施例提供的一种可能的关于多个版本的差异数据的示意图。如图6的(1)部分所示,在版本1的结构化数据中新增了教师表和学生表,差异部分如区域601所示。而图7所示的差异数据中,关于版本1的差异数据包含版本1的标识、教师表和学生表的标识(分别为E01、E02)、差异类型以及教师表和学生表的属性。
如图6的(2)部分所示,在版本2的结构化数据中将教师表的注释从“教师”变更为“教师表”,版本2与版本1的差异部分如区域602所示。而图7所示的差异数据中,关于版本2的差异数据包含版本2的标识、教师表的标识(即:E01)、差异类型(即:CHANGE)以及教师表的属性。
如图6的(3)部分所示,在版本3的结构化数据中将学生表的注释从“学生”变更为“学生表”,版本3与版本2的差异部分如区域603所示。而图7所示的差异数据中,关于版本3的差异数据包含版本3的标识、学生表的标识(即:E01)、差异类型(即:CHANGE)以及学生表的属性。
如图6的(4)部分所示,在版本4的结构化数据中,包含以下两个差异部分:①将教师表的表名从“teacher”变更为“db_teacher”,如区域604所示;②删除学生表,如区域605所示。而图7所示的差异数据中,关于版本4的差异数据包含版本4的标识、教师表和学生表的标识(分别为E01、E02)、差异类型以及教师表和学生表的属性。
类似的,如图6的(5)部分所示,在版本5的结构化数据中新增了班级表,版本5与版本5的差异部分如区域606所示。而图7所示的差异数据中,关于版本5的差异数据包含版 本4的标识、班级表的标识(分别为E03)、差异类型以及班级表的属性。
应理解,图6和图7以表这一模块为例进行说明,并不旨在限定本方案仅用于表,对于字段等其他元素等同样适用。
可选的,在第一版本为第一个版本的结构化数据时,上一个版本数据可以是默认数据或空白数据。进一步可选的,服务器可以通过预先配置、预先设定、或接收用户输入等方式得到该默认数据。
在图3所示的实施例中,服务器可以通过增量存储方式,来记录不同版本的结构化数据的变更,实现了对于结构化数据的变更记录。一方面,用户可以便捷地查看到不同版本直接的迭代变化,方便用户进行版本回溯,满足了对结构化数据变更的可视化需求。另一方面,服务器记录不同版本地结构化数据时,无需记录整个结构化数据,降低了记录量。
一种可能的设计中,服务器可以基于上述差异数据,满足用户的横向回溯需求。请参见图8,图8是本申请实施例提供的又一种可能的版本方法的流程示意图。可选的,该方法可以应用图2所示的数据库设计系统。应理解,本申请为了方便描述,故通过图8所示的顺序进行描述,并不旨在限定一定通过上述顺序进行执行。对于上述一个或多个步骤的执行的先后顺序、执行的时间、执行的次数等不做限定。
可选的,如图8所示方法实施例可以包含步骤S801-步骤S803中的部分或者全部步骤。步骤S801-步骤S803的相关描述可以参考步骤S301-步骤S303。此处不在赘述。
可选的,图8所示的方法实施例可以包含步骤S804,具体如下:
步骤S804:服务器接收来自用户设备的第一请求信息。其中,第一请求信息用于请求所述第一版本的结构化数据。
例如,用户设备在打开某一界面时,默认获取最新版本的结构化数据,而第一版本是最新版本。这种情况下,用户设备在打开某一界面时,可以向服务器发送第一请求信息,从而请求查看第一版本的结构化数据。相应的,服务器接收来自用户设备的第一请求信息。
再如,用户设备可以向用户展示一个或者多个版本的信息,用户设备接收用户输入的针对第一版本的选择操作,从而向服务器发送第一请求信息。相应的,服务器接收来自用户设备的第一请求信息。
示例性地,请参见图9,图9是本申请实施例提供的一种可能的多个版本的信息的示意图。区域901展示了3个版本的信息,分别为版本5、版本4、版本3。“提交者”为提交该版本的结构化数据的用户。“创建时间”说明提交该版本的结构化数据的时间、或者形成该版本结构化数据的时间。“操作”用于指示可对该版本的结构化数据执行的操作。例如,区域902所示的组件用于回退版本、或者用于指示呈现回退版本的界面。例如,当前版本为版本5,用户点击版本3对应的回退按钮,可以回退到版本3。区域903所示的组件用于查看一个或多个版本或者指示呈现查看指定版本的结构化数据。例如,点击区域903所示的组件,可以呈现版本5的结构化数据。区域904所示的组件,用于查看指定版本的流程信息,例如查看版本5的审核流程信息。其中,审核流程信息可以包含审核人、变更差异可视化、或数据库模式定义语言(Data Definition Language。DDL)等中的一项或者多项。
在如图9所示的界面可以由用户设备呈现。用户可以根据自身需求选择某一版本,服务用户设备接收用户输入的针对第一版本的选择操作,该操作指示查看第一版本的结构化数据。如此,用户设备则向服务器发送第一请求信息,请求第一版本的结构化数据。
图8所示的实施例至少包含步骤S805,具体如下:
步骤S805:服务器根据关于第一版本的差异数据、以及关于第一版本之前的版本的差异数据,得到第一版本的结构化数据。
其中,由于差异数据可以反映当前版本与上一个版本之间的差异。因此,第一版本的差异数据、以及关于第一版本之前的版本的差异数据,可以得到第一版本的结构化数据。
一种设计中,服务器在总差异数据中,确定关于第一版本的差异数据、以及关于第一版本之前的版本的差异数据。服务器按照从新到旧的顺序,进行去重操作,得到当前版本的全量元素。
可选的,进行去重操作时,具体可以是保留某一ID的元素的最新版本的差异数据、以及去掉操作类型包含“删除”(或“DROP”)的元素。
例如,以图7所示的数据为总差异数据为例,若服务器需得到版本5的结构化数据。服务器先确定关于版本5的差异数据,以及关于版本4、版本3、版本2和版本1的差异数据,按照版本从新到旧,进行去重操作。例如,关于版本5的差异数据中(第8行),ID为“E03”的元素,则保留作为版本5的结构化数据中的元素。再如,关于版本4的差异数据中(第7行),ID为“E02”的元素,由于其操作类型包含“DROP”,因此版本5的结构化数据中不包含ID为“E02”的元素。再如,关于版本4的差异数据中(第6行),ID为“E01”的元素,最新版本的差异数据是关于版本4,因此版本5的结构化数据中包含ID为“E01”的元素。ID为“E01”的元素,其在版本5中的属性和值为:表名是“db_teacher”,注释是“教师表”。
类似的,以图7所示的数据为总差异数据为例,若服务器需得到版本1的结构化数据。服务器先确定关于版本1的差异数据,而版本1之前没有对应的版本,因此服务器根据版本1的差异数据,得到版本1的结构化数据。例如,图7的第1行所示ID为“E01”的元素,保留作为版本1的结构化数据中的元素;如图7的第2行所示ID为“E02”的元素,也保留作为版本1的结构化数据中的元素。
可选的,服务器可以向用户设备发送该第一版本的结构化数据。相应的,用户设备可以接收第一版本的结构化数据,从而呈现该第一版本的结构化数据。
一种可能的设计中,服务器可以根据关于第一版本之前的版本的差异数据,得到上一个版本的结构化数据。进一步的,服务器可以根据关于第一版本的差异数据和所述上一个版本的结构化数据,得到第一版本的结构化数据。
在图8所示的实施例中,服务器可以根据一个或者多个版本的差异数据,得到不同版本的结构化数据。服务器可以响应需求提供不同版本对应的结构化数据,满足对不同版本的结构化数据的查看需求,提升了用户的使用体验。
一种可能的设计中,服务器可以基于上述差异数据,满足用户的纵向回溯需求。请参见图10,图10是本申请实施例提供的又一种可能的版本方法的流程示意图。可选的,该方法可以应用图2所示的数据库设计系统。应理解,本申请为了方便描述,故通过图10所示的顺序进行描述,并不旨在限定一定通过上述顺序进行执行。对于上述一个或多个步骤的执行的先后顺序、执行的时间、执行的次数等不做限定。
可选的,如图10所示方法实施例可以包含步骤S1001-步骤S1003中的部分或者全部步骤。步骤S1001-步骤S1003的相关描述可以参考步骤S301-步骤S303。此处不在赘述。
可选的,图10所示的方法实施例可以包含步骤S1004,具体如下:
步骤S1004:服务器接收来自用户设备的第二请求信息。其中,第二请求信息用于请求第一元素的变更记录。或者可选的,变更记录也可以称为第一元素的生命周期、或历史信息 等。
其中,第一元素是结构化数据所指示的一个或者多个元素中的至少一个元素。
例如,以数据库模型数据为例,数据库模型数据中可以包含一个或者多个元素的属性,例如包含一个或者多个表的属性,再如,包含一个或者多个字段的属性。用户可以查看其中的某一个(或者某几个)元素的变更记录。
该变更记录可以查看该元素经历的创建、修改等记录。
图10所示的实施例至少包含步骤S1005,具体如下:
步骤S1005:服务器根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述第一元素的信息,得到所述第一元素的变更记录。
示例性地,以差异数据为如图7所示的差异数据为例,若服务器需得到ID为“E01”的元素的变更记录,则可以在图7所示的差异数据,确定ID为“E01”的元素对应的差异数据,具体可以为第2行、第3行、第5行对应的数据。可以看出,“E01”的元素对应的差异数据反映了创建、修改过程。
可选的,服务器可以将第一元素对应的差异数据,作为第一元素的变更记录。或者可选的,服务器可以对第一元素对应的差异数据进行进一步处理,得到第一元素的变更记录。
可选的,服务器可以向用户反馈第一元素的变更记录。例如,服务器可以向用户设备发送第一元素的变更记录,相应的,用户设备接收第一元素的变更记录,从而呈现该第一元素的变更记录。
在图10所示的实施例中,服务器根据差异数据可以实现对元素的纵向回溯,从而使得用户可以了解表A是在哪个版本进行创建、在哪个版本进行了更新,直观地获取元素的生命周期,提升了用户体验。
需要说明的是,上述的多个实施例可以在不互斥的情况下进行结合,本申请对于结合的情况不再一一示例。
上述详细阐述了本申请实施例的方法,下面提供本申请实施例的装置。
请参见图11,图11是本申请实施例提供的一种版本管理装置110的结构示意图,该版本管理装置110可以为服务器或用户设备,也可以为服务器或用户设备中的一个器件,例如芯片、软件模块、集成电路等。该版本管理装置110用于实现前述的版本管理方法,例如图3、图8或图10所示实施例中的版本管理方法。
一种可能的实施方式中,该版本管理装置110可以包括获取单元1101和处理单元1102。
一种可能的设计中,上述版本管理装置110可以为前述实施例中的服务器。
在一种可能的实施方式中,所述获取单元1101,用于获取第一版本的结构化数据,所述结构化数据包含元素的属性以及所述属性对应的值;
所述处理单元1102,用于根据所述第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,所述关于第一版本的差异数据表征所述第一版本的结构化数据与所述上一个版本的结构化数据之间的差异,所述关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识以及变更操作类型;
所述处理单元1102,还用于记录对应所述第一版本的所述差异数据。
在又一种可能的实施方式中,所述结构化数据包含一个或者多个模块,每一个模块包含部分元素的属性和所述部分元素的属性对应的值;
所述处理单元1102,还用于:
将所述第一版本的结构化数据和所述上一个版本的结构化数据,按模块进行比较,得到所述关于所述第一版本的差异数据,所述差异数据包含对应所述一个或者多个模块的差异数据。
可选的,在进行去重时,处理单元1102可以按照版本从新到旧的顺序,进行去重操作,得到当前版本的全量元素。
可选的,处理单元1102进行去重操作时,可以保留某一ID的元素的最新版本的差异数据、以及去掉操作类型包含“删除”(即:“DROP”)的元素。
在又一种可能的实施方式中,所述获取单元1101,还用于接收来自用户设备的第一请求信息,所述第一请求信息用于请求所述第一版本的结构化数据;
所述处理单元1102,还用于根据关于所述第一版本的差异数据以及关于所述第一版本之前的版本的差异数据,得到所述第一版本的结构化数据。
在又一种可能的实施方式中,所述获取单元1101,还用于接收来自用户设备的第二请求信息,所述第二请求信息用于请求第一元素的变更记录,所述第一元素属于所述一个或者多个元素;
所述处理单元1102,还用于根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述第一元素的信息,得到所述第一元素的变更记录。
在又一种可能的实施方式中,所述变更操作类型包含添加、删除或更新等中的一项或者多项。
在又一种可能的实施方式中,所述结构化数据包含数据库模型数据、JSON数据、或可扩展标记语言XML数据中的一项或者多项。
在又一种可能的实施方式中,所述结构化数据包含数据库模型数据,所述一个或者多个元素包含属于以下元素种类中的一种或者多种:表、字段、索引、视图、或关系。
应理解,相关描述还可以参见图3、图8或图10所示实施例中的描述,此处不再赘述。
请参见图12,图12是本申请实施例提供的一种计算设备120的结构示意图,该计算设备120可以为独立设备(例如服务器、或用户设备等等中的一个或者多个),也可以为独立设备内部的部件(例如芯片、软件模块或者硬件模块等)。该计算设备120可以包括至少一个处理器1201。可选的还可以包括至少一个存储器1203。进一步可选的,计算设备120还可以包括通信接口1202。更进一步可选的,还可以包含总线1204,其中,处理器1201、通信接口1202和存储器1203通过总线1204相连。
其中,处理器1201是进行算术运算和/或逻辑运算的模块,具体可以是中央处理器(central processing unit,CPU)、图片处理器(graphics processing unit,GPU)、微处理器(microprocessor unit,MPU)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程逻辑门阵列(Field Programmable Gate Array,FPGA)、复杂可编程逻辑器件(Complex programmable logic device,CPLD)、协处理器(协助中央处理器完成相应处理和应用)、微控制单元(Microcontroller Unit,MCU)等处理模块中的一种或者多种的组合。
通信接口1202可以用于为所述至少一个处理器提供信息输入或者输出。和/或,所述通信接口1202可以用于接收外部发送的数据和/或向外部发送数据,可以为包括诸如以太网电缆等的有线链路接口,也可以是无线链路(Wi-Fi、蓝牙、通用无线传输、车载短距通信技术以及其他短距无线通信技术等)接口。可选的,通信接口1202还可以包括与接口耦合的发射 器(如射频发射器、天线等),或者接收器等。
存储器1203用于提供记录空间,记录空间中可以记录操作系统和计算机程序等数据。存储器1203可以是随机记录记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM)等等中的一种或者多种的组合。
该计算设备120中的至少一个处理器1201用于执行前述的版本管理方法,例如图3、图8或图10所示实施例所描述的版本管理方法。
可选的,处理器1201可以是专门用于执行这些方法的处理器(便于区别称为专用处理器),也可以是通过调用计算机程序来执行这些方法的处理器,例如通用处理器。可选的,至少一个处理器还可以既包括专用处理器也包括通用处理器。可选的,在计算设备包括至少一个处理器1201的情况下,上述计算机程序可以存在存储器1203中。
一种可能的设计中,上述计算设备120可以为前述实施例中的服务器。
在一种可能的实施方式中,该计算设备120中的至少一个处理器1201用于执行调用计算机指令,以执行以下操作:
获取第一版本的结构化数据,所述结构化数据包含元素的属性以及所述属性对应的值;
根据所述第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,所述关于第一版本的差异数据表征所述第一版本的结构化数据与所述上一个版本的结构化数据之间的差异,所述关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识以及变更操作类型;
记录对应所述第一版本的所述差异数据。
在又一种可能的实施方式中,所述结构化数据包含一个或者多个模块,每一个模块包含部分元素的属性和所述部分元素的属性对应的值;
所述处理器1201,还用于:
将所述第一版本的结构化数据和所述上一个版本的结构化数据,按模块进行比较,得到所述关于所述第一版本的差异数据,所述差异数据包含对应所述一个或者多个模块的差异数据。
可选的,在进行去重时,处理器1201可以按照版本从新到旧的顺序,进行去重操作,得到当前版本的全量元素。
可选的,处理器1201进行去重操作时,可以保留某一ID的元素的最新版本的差异数据、以及去掉操作类型包含“删除”(即:“DROP”)的元素。
在又一种可能的实施方式中,所述处理器1201,还用于:
通过通信接口1202接收来自用户设备的第一请求信息,所述第一请求信息用于请求所述第一版本的结构化数据;
根据关于所述第一版本的差异数据以及关于所述第一版本之前的版本的差异数据,得到所述第一版本的结构化数据。
在又一种可能的实施方式中,所述处理器1201,还用于:
通过通信接口1202接收来自用户设备的第二请求信息,所述第二请求信息用于请求第一元素的变更记录,所述第一元素属于所述一个或者多个元素;
根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述 第一元素的信息,得到所述第一元素的变更记录。
在又一种可能的实施方式中,所述变更操作类型包含添加、删除或更新等中的一项或者多项。
在又一种可能的实施方式中,所述结构化数据包含数据库模型数据、JSON数据、或可扩展标记语言XML数据中的一项或者多项。
在又一种可能的实施方式中,所述结构化数据包含数据库模型数据,所述一个或者多个元素包含属于以下元素种类中的一种或者多种:表、字段、索引、视图、或关系。
应理解,相关描述还可以参见图3、图8或图10所示实施例中的描述,此处不再赘述。
本申请还提供了一种算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在至少一个处理器上运行时,实现前述的版本管理方法,例如图3、图8或图10所示的版本管理方法。
本申请还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,在被计算设备执行时,实现前述的版本管理方法,例如图3、图8或图10所示的版本管理方法。
本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
本申请中实施例提到的“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b、或c中的至少一项(个),可以表示:a、b、c、(a和b)、(a和c)、(b和c)、或(a和b和c),其中a、b、c可以是单个,也可以是多个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A、同时存在A和B、单独存在B这三种情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。
以及,除非有相反的说明,本申请实施例使用“第一”、“第二”等序数词是用于对多个对象进行区分,不用于限定多个对象的顺序、时序、优先级或者重要程度。例如,第一用户设备和第二用户设备,只是为了便于描述,而并不是表示这第一用户设备和第二用户设备的结构、重要程度等的不同,在某些实施例中,第一用户设备和第二用户设备还可以是同样的设备。
上述实施例中所用,根据上下文,术语“当……时”可以被解释为意思是“如果……”或“在……后”或“响应于确定……”或“响应于检测到……”。以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的构思和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以记录于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。

Claims (16)

  1. 一种结构化数据的版本管理方法,其特征在于,包括:
    获取第一版本的结构化数据,所述结构化数据包含元素的属性以及所述属性对应的值;
    根据所述第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,所述关于第一版本的差异数据表征所述第一版本的结构化数据与所述上一个版本的结构化数据之间的差异,所述关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识以及变更操作类型;
    记录关于所述第一版本的所述差异数据。
  2. 根据权利要求1所述的方法,其特征在于,所述结构化数据包含一个或者多个模块,每一个模块包含部分元素的属性和所述部分元素的属性对应的值;
    所述根据第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,包括:
    将所述第一版本的结构化数据和所述上一个版本的结构化数据,按模块进行比较,得到所述关于所述第一版本的差异数据,所述关于所述第一版本的差异数据包含对应所述一个或者多个模块的差异数据。
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:
    接收来自用户设备的第一请求信息,所述第一请求信息用于请求所述第一版本的结构化数据;
    根据关于所述第一版本的差异数据以及关于所述第一版本之前的版本的差异数据,得到所述第一版本的结构化数据。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述方法还包括:
    接收来自用户设备的第二请求信息,所述第二请求信息用于请求第一元素的变更记录,所述第一元素属于所述元素;
    根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述第一元素的信息,得到所述第一元素的变更记录。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述变更操作类型包含添加、删除或更新中的一项或者多项。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述结构化数据属于数据库模型数据、JSON数据、或可扩展标记语言XML数据。
  7. 根据权利要求6所述的方法,其特征在于,所述结构化数据属于数据库模型数据,
    所述元素属于以下元素种类中的一种或者多种:表、字段、索引、视图、或关系。
  8. 一种版本管理装置,其特征在于,包括:
    获取单元,用于获取第一版本的结构化数据,所述结构化数据包含元素的属性以及所述属性对应的值;
    处理单元,用于根据所述第一版本的结构化数据和上一个版本的结构化数据,得到关于所述第一版本的差异数据,所述关于第一版本的差异数据表征所述第一版本的结构化数据与所述上一个版本的结构化数据之间的差异,所述关于第一版本的差异数据包含所述第一版本的标识、存在变更的元素的标识以及变更操作类型;
    所述处理单元,还用于记录对应所述第一版本的所述差异数据。
  9. 根据权利要求8所述的装置,其特征在于,所述结构化数据包含一个或者多个模块,每一个模块包含部分元素的属性和所述部分元素的属性对应的值;
    所述处理单元,还用于:
    将所述第一版本的结构化数据和所述上一个版本的结构化数据,按模块进行比较,得到所述关于所述第一版本的差异数据,所述差异数据包含对应所述一个或者多个模块的差异数据。
  10. 根据权利要求8或9任一项所述的装置,其特征在于,
    所述获取单元,还用于接收来自用户设备的第一请求信息,所述第一请求信息用于请求所述第一版本的结构化数据;
    所述处理单元,还用于根据关于所述第一版本的差异数据以及关于所述第一版本之前的版本的差异数据,得到所述第一版本的结构化数据。
  11. 根据权利要求8-10任一项所述的装置,其特征在于,
    所述获取单元,还用于接收来自用户设备的第二请求信息,所述第二请求信息用于请求第一元素的变更记录,所述第一元素属于所述一个或者多个元素;
    所述处理单元,还用于根据关于所述第一版本的差异数据、关于所述第一版本之前的版本的差异数据以及所述第一元素的信息,得到所述第一元素的变更记录。
  12. 根据权利要求8-11任一项所述的装置,其特征在于,所述变更操作类型包含添加、删除或更新中的一项或者多项。
  13. 根据权利要求8-12任一项所述的装置,其特征在于,所述结构化数据包含数据库模型数据、JSON数据、或可扩展标记语言XML数据中的一项或者多项。
  14. 根据权利要求13所述的装置,其特征在于,所述结构化数据包含数据库模型数据,
    所述一个或者多个元素包含属于以下元素种类中的一种或者多种:表、字段、索引、视图、或关系。
  15. 一种计算设备,其特征在于,所述计算设备包括处理器和存储器;
    所述存储器中存储有计算机程序;
    所述处理器执行所述计算机程序时,所述计算设备执行前述权利要求1至7中任一项所述的方法。
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当所述指令在至少一个处理器上运行时,实现如权利要求1至7中任一项所述的方法。
PCT/CN2022/115326 2021-09-29 2022-08-27 结构化数据的版本管理方法、装置及相关设备 WO2023051125A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111154746.4 2021-09-29
CN202111154746.4A CN115878589A (zh) 2021-09-29 2021-09-29 结构化数据的版本管理方法、装置及相关设备

Publications (1)

Publication Number Publication Date
WO2023051125A1 true WO2023051125A1 (zh) 2023-04-06

Family

ID=85756390

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/115326 WO2023051125A1 (zh) 2021-09-29 2022-08-27 结构化数据的版本管理方法、装置及相关设备

Country Status (2)

Country Link
CN (1) CN115878589A (zh)
WO (1) WO2023051125A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117271480A (zh) * 2023-11-20 2023-12-22 国能日新科技股份有限公司 数据处理方法、装置、电子设备及介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573199B (zh) * 2024-01-16 2024-04-16 成都安世赛斯特软件技术有限公司 一种模型差异对比分析方法、装置、设备及介质

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090094273A1 (en) * 2007-10-05 2009-04-09 Canon Kabushiki Kaisha Information processing apparatus and control method thereof, and document verification apparatus and control method thereof
CN101517611A (zh) * 2006-09-20 2009-08-26 微软公司 电子数据交换(edi)数据字典的差异分析

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101517611A (zh) * 2006-09-20 2009-08-26 微软公司 电子数据交换(edi)数据字典的差异分析
US20090094273A1 (en) * 2007-10-05 2009-04-09 Canon Kabushiki Kaisha Information processing apparatus and control method thereof, and document verification apparatus and control method thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117271480A (zh) * 2023-11-20 2023-12-22 国能日新科技股份有限公司 数据处理方法、装置、电子设备及介质
CN117271480B (zh) * 2023-11-20 2024-03-15 国能日新科技股份有限公司 数据处理方法、装置、电子设备及介质

Also Published As

Publication number Publication date
CN115878589A (zh) 2023-03-31

Similar Documents

Publication Publication Date Title
WO2023051125A1 (zh) 结构化数据的版本管理方法、装置及相关设备
US9519701B2 (en) Generating information models in an in-memory database system
US11726969B2 (en) Matching metastructure for data modeling
US10423392B2 (en) Systems and methods for transactional applications in an unreliable wireless network
US9031920B2 (en) Objects in a storage environment for connected applications
CN115617327A (zh) 低代码页面搭建系统、方法及计算机可读存储介质
US9223847B2 (en) Using dimension substitutions in OLAP cubes
WO2024001493A1 (zh) 一种可视化的数据分析方法及设备
EP3486798A1 (en) Reporting and data governance management
US20140006000A1 (en) Built-in response time analytics for business applications
CN110889013B (zh) 一种基于xml的数据关联方法、装置、服务器及存储介质
US10489024B2 (en) UI rendering based on adaptive label text infrastructure
CN113094776B (zh) 可视化组件模型数据构建的方法、系统及电子设备
CN117453980A (zh) 元数据管理、配置页面生成方法、服务器及存储介质
US20130227147A1 (en) Systems and methods for creating web service compositions
US11900269B2 (en) Method and apparatus for managing knowledge base, device and medium
US20210264312A1 (en) Facilitating machine learning using remote data
US10318524B2 (en) Reporting and data governance management
WO2024016594A1 (zh) 一种伪列实现方法、装置、电子设备及存储介质
WO2023279752A1 (zh) 数据库模型的版本管理方法、装置及相关设备
CN113342325A (zh) 可视化建模方法、系统、电子设备及存储介质
JP5685205B2 (ja) プログラム、情報処理装置およびアクセス支援方法
US11847134B2 (en) Computerized system for programmatic mapping of record lineage based on data flow through data storage components
CN117008890B (zh) 扩展应用开发系统及方法
WO2023273410A1 (zh) 规范设计方法、装置及相关设备

Legal Events

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

Ref document number: 22874517

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE