[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN111125064A - Method and device for generating database mode definition statement - Google Patents

Method and device for generating database mode definition statement Download PDF

Info

Publication number
CN111125064A
CN111125064A CN201911347549.7A CN201911347549A CN111125064A CN 111125064 A CN111125064 A CN 111125064A CN 201911347549 A CN201911347549 A CN 201911347549A CN 111125064 A CN111125064 A CN 111125064A
Authority
CN
China
Prior art keywords
definition
database
code
model file
field
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
CN201911347549.7A
Other languages
Chinese (zh)
Other versions
CN111125064B (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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN201911347549.7A priority Critical patent/CN111125064B/en
Publication of CN111125064A publication Critical patent/CN111125064A/en
Application granted granted Critical
Publication of CN111125064B publication Critical patent/CN111125064B/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
    • G06F16/211Schema design and management
    • G06F16/212Schema design and management with details for data modelling support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

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

Abstract

The invention discloses a method and a device for generating database mode definition sentences, and relates to the technical field of computers. One embodiment of the method comprises: importing a model file, reading the model file to analyze database definition parameters of the model file; the database definition parameters comprise field names, database names and partition definition information; calling a code definition template and generating a field definition code according to the database definition parameters; and filling the field definition code into the code definition template to generate a database schema definition statement. The implementation method can solve the technical problem of high difficulty in code development.

Description

Method and device for generating database mode definition statement
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating database mode definition sentences.
Background
In the database definition process, a database developer needs to design a logical structure of a database on one hand and design physical parameters such as partitions, storage and the like related to the logical structure on the other hand. The combination of the above two aspects is a DDL (database schema definition Language) statement in the final state.
The logical structure design of the database is to convert the basic entity-relationship diagram designed in the conceptual structure design stage into a logical structure corresponding to the data model supported by the selected database management system product. The physical parameters of the database mainly comprise a partition mode of the database, compression options during storage of the database, file space allocation options and other parameters. Based on the above, the full-flow management of the database definition needs to fuse the above designs at the level of the DDL statement and finally deploy the designs to a background development environment.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
at present, a database developer generally needs to write a large number of DDL statements and effective scripts, and then migrate the DDL statements and the effective scripts to different test environments for effectiveness. When the database definitions are more and the parameter difference between the definitions is large, the operation complexity of database developers is large, and the error rate is high. Particularly, in the development stage of software, the database definition is changed relatively frequently, the workload and the labor cost are multiplied, and more importantly, the timeliness and the correctness of the change directly influence the progress of development and test work.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for generating a database schema definition statement, so as to solve the technical problem of high difficulty in code development.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of generating a database schema definition statement, including:
importing a model file, reading the model file to analyze database definition parameters of the model file; the database definition parameters comprise field names, database names and partition definition information;
calling a code definition template and generating a field definition code according to the database definition parameters;
and filling the field definition code into the code definition template to generate a database schema definition statement.
Optionally, the model file is an XML file output by a data modeling tool, and the model file includes a structure of a database table and an index structure of the database table.
Optionally, invoking a code definition template and generating a field definition code according to the database definition parameter includes:
matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information;
and calling a corresponding code definition template according to the database name and the partition definition information.
Optionally, before reading the model file, the method further includes:
updating the model file in response to configuration information entered by a user.
In addition, according to another aspect of the embodiments of the present invention, there is provided an apparatus for generating a database schema definition statement, including:
the analysis module is used for importing a model file and reading the model file so as to analyze the database definition parameters of the model file; the database definition parameters comprise field names, database names and partition definition information;
the definition module is used for calling a code definition template according to the database definition parameters and generating field definition codes;
and the filling module is used for filling the field definition codes into the code definition template so as to generate the database schema definition statement.
Optionally, the model file is an XML file output by a data modeling tool, and the model file includes a structure of a database table and an index structure of the database table.
Optionally, the definition module is further configured to:
matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information;
and calling a corresponding code definition template according to the database name and the partition definition information.
Optionally, the parsing module is further configured to:
and before reading the model file, responding to configuration information input by a user, and updating the model file.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: the technical means that the database definition parameters of the model file are analyzed, the code definition template is called according to the database definition parameters, the field definition codes are generated, and the field definition codes are filled in the code definition template to generate the database mode definition statement is adopted, so that the technical problem of high code development difficulty in the prior art is solved. The embodiment of the invention can directly import the universal database logic structure design model file, and obtains the code definition template and the field definition code by analyzing the database definition parameters of the model file, thereby generating the database mode definition statement, reducing the code development difficulty and saving the time for database developers to compile DDL. Therefore, the embodiment of the invention greatly shortens the timeliness and convenience of the iteration of the database definition version and simultaneously reduces the labor cost of database management.
Moreover, the embodiment of the invention also supports interaction with a background test environment, automatically executes an effective process, and the generated database schema definition statement can be submitted to the test environment in one key type to complete the deployment of the database definition, thereby greatly shortening the timeliness and the convenience of the iteration of the database definition version and simultaneously reducing the labor cost of database management.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of generating database schema definition statements according to an embodiment of the invention;
FIG. 2 is a schematic diagram of the main flow of a method of generating database schema definition statements according to a referenceable embodiment of the invention;
FIG. 3 is a schematic diagram of the main flow of a method of generating database schema definition statements according to another referenceable embodiment of the invention;
FIG. 4 is a schematic diagram of the major modules of a device for generating database schema definition statements according to an embodiment of the invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a method of generating a database schema definition statement according to an embodiment of the invention. As an embodiment of the present invention, as shown in fig. 1, the method for generating a database schema definition statement may include:
step 101, importing a model file, and reading the model file to analyze a database definition parameter of the model file.
Firstly, a model file is output through a data modeling tool, then the model file is imported, and the model file is read, so that the database definition parameters of the model file are analyzed. Optionally, the model file is an XML file output by a data modeling tool, and the model file includes a structure of a database table and an index structure of the database table. Alternatively, the Data modeling tool may be erpin (ERWIN Data Modeler, Data modeling tool of ERWIN corporation), and a developer may design a logical structure of the database through ERWIN, and finally output a model file in an XML format, where the model file includes a structure of a database table, a structure of an index, and the like. The database definition refers to a definition (such as tablespace, table, index, etc.) of a database object. Optionally, the database definition parameter includes a field name, a database name, and partition definition information.
Optionally, before reading the model file, the method further comprises: updating the model file in response to configuration information entered by a user. In an embodiment of the present invention, after the model file is imported, it may also be configured. In particular, the developer may add optional configuration parameters (such as database names, partition definition parameters, etc.) to form a new XML model file. The configuration information may be a field name, a database name, or partition definition information.
And 102, calling a code definition template according to the database definition parameters and generating field definition codes.
After the database definition parameters are parsed, a code definition template may be invoked and field definition codes may be generated based on the database definition parameters. Optionally, step 102 may comprise: matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information; and calling a corresponding code definition template according to the database name and the partition definition information. In the embodiment of the present invention, it is necessary to configure in advance the correspondence between each database name and each field name and type definition information, so as to generate a field definition code according to the matched definition type information. For example, the type definition of character type in DB2 data is char (n), and the type definition in oracle is char (n); the type definition of the numerical type in the DB2 data is smallnt/int/bigint, the type definition in the oracle is number (n), and the corresponding relations can be stored in the enterprise data dictionary. The embodiment of the invention can flexibly set the database differentiation definition information of different legal persons and generate the table definition information of different database types such as DB2, ORACLE and the like.
Therefore, the data modeling tool can design the model relation only by focusing on the field name, does not need to bring in type information, and supports different types of definitions of the same field (different platform differences, such as data type definition differences of DB2 and oracle). Alternatively, the implementation may be that the program is mapped to different database field definition codes according to the basic type definition in the data dictionary.
Similarly, the corresponding relationship between each database name and partition definition information and the code definition template needs to be configured in advance, so that the corresponding code definition template is called according to the database name and the partition definition information.
In addition to the field information, other database definition parameters, such as schema, db name, partition definition information, etc., are also parsed at the same time. For example, the corresponding code definition template may be called according to the database name and the parsed partition definition information for generating the final database schema definition statement.
And 103, filling the field definition codes into the code definition template to generate a database schema definition statement.
And after the field definition codes and the code definition templates are obtained, filling the field definition codes into the code definition templates so as to obtain the final database schema definition statement.
According to the various embodiments, the technical means that the database definition parameters of the model file are analyzed, the code definition template is called according to the database definition parameters, the field definition codes are generated, and the field definition codes are filled in the code definition template to generate the database mode definition statement are adopted, so that the technical problem of high code development difficulty in the prior art is solved. The embodiment of the invention can directly import the universal database logic structure design model file, and obtains the code definition template and the field definition code by analyzing the database definition parameters of the model file, thereby generating the database mode definition statement, reducing the code development difficulty and saving the time for database developers to compile DDL. Therefore, the embodiment of the invention greatly shortens the timeliness and convenience of the iteration of the database definition version and simultaneously reduces the labor cost of database management.
FIG. 2 is a schematic diagram of the main flow of a method of generating database schema definition statements according to a referenceable embodiment of the invention. As another embodiment of the present invention, as shown in fig. 2, the method for generating a database schema definition statement may include:
step 201, importing a model file.
The model file may be output by a data modeling tool and then imported. Optionally, the data modeling tool may be erlin, and a developer may design a logical structure of the database through erlin, and finally output a model file in an XML format, where the model file includes a structure of a database table, a structure of an index, and the like.
Step 202, updating the model file in response to configuration information input by a user.
In an embodiment of the present invention, after the model file is imported, it may also be configured. In particular, the developer may add optional configuration parameters (such as database names, partition definition parameters, etc.) to form a new XML model file. The configuration information may be a field name, a database name, or partition definition information.
Step 203, reading the model file to analyze the database definition parameters of the model file.
And reading the model file so as to analyze the database definition parameters of the model file. Optionally, the database definition parameter includes a field name, a database name, and partition definition information.
And 204, matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information.
The corresponding relationship between each database name and each field name and type definition information needs to be configured in advance, so that a field definition code is generated according to the matched definition type information. For example, the type definition of character type in DB2 data is char (n), and the type definition in oracle is char (n); the type definition of the numerical type in the DB2 data is smallnt/int/bigint, the type definition in the oracle is number (n), and the corresponding relations can be stored in the enterprise data dictionary.
Step 205, calling a corresponding code definition template according to the database name and the partition definition information.
The corresponding relationship between each database name and partition definition information and the code definition template needs to be configured in advance, so that the corresponding code definition template is called according to the database name and the partition definition information.
Step 206, filling the field definition code into the code definition template to generate a database schema definition statement.
And after the field definition codes and the code definition templates are obtained, filling the field definition codes into the code definition templates so as to obtain the final database schema definition statement.
In addition, in a reference embodiment of the present invention, the detailed implementation content of the method for generating the database schema definition statement is already described in detail in the above-mentioned method for generating the database schema definition statement, so that the repeated content is not described again.
FIG. 3 is a schematic diagram of the main flow of a method of generating database schema definition statements according to another referenceable embodiment of the invention. As another embodiment of the present invention, as shown in fig. 3, the method for generating a database schema definition statement may include:
step 301, importing a model file, and reading the model file to analyze a database definition parameter of the model file.
And 302, matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information.
Step 303, calling a corresponding code definition template according to the database name and the partition definition information.
And step 304, filling the field definition code into the code definition template to generate a database schema definition statement.
Step 305, uploading the database mode definition statement to a test environment, and running the database mode definition statement in the test environment.
The embodiment of the invention reduces the code development difficulty, saves the time of a database developer for writing DDL, supports the interaction with a background test environment, automatically executes the effective process, and can submit the generated database mode definition statement to the test environment in one key to complete the deployment of the database definition, thereby greatly shortening the timeliness and the convenience of the iteration of the database definition version and simultaneously reducing the labor cost of database management.
In addition, in a reference embodiment of the present invention, the detailed implementation content of the method for generating the database schema definition statement is already described in detail in the above-mentioned method for generating the database schema definition statement, so that the repeated content is not described again.
Fig. 4 is a schematic diagram of main modules of a device for generating a database schema definition statement according to an embodiment of the present invention, and as shown in fig. 4, the device 400 for generating a database schema definition statement includes a parsing module 401, a definition module 402, and a filling module 403. The analysis module 401 is configured to import a model file, read the model file, and analyze a database definition parameter of the model file; the database definition parameters comprise field names, database names and partition definition information; the definition module 402 is used for calling a code definition template according to the database definition parameters and generating field definition codes; the filling module 403 is configured to fill the field definition code into the code definition template to generate a database schema definition statement.
Optionally, the model file is an XML file output by a data modeling tool, and the model file includes a structure of a database table and an index structure of the database table.
Optionally, the defining module 402 is further configured to:
matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information;
and calling a corresponding code definition template according to the database name and the partition definition information.
Optionally, the parsing module 401 is further configured to:
and before reading the model file, responding to configuration information input by a user, and updating the model file.
According to the various embodiments, the technical means that the database definition parameters of the model file are analyzed, the code definition template is called according to the database definition parameters, the field definition codes are generated, and the field definition codes are filled in the code definition template to generate the database mode definition statement are adopted, so that the technical problem of high code development difficulty in the prior art is solved. The embodiment of the invention can directly import the universal database logic structure design model file, and obtains the code definition template and the field definition code by analyzing the database definition parameters of the model file, thereby generating the database mode definition statement, reducing the code development difficulty and saving the time for database developers to compile DDL. Therefore, the embodiment of the invention greatly shortens the timeliness and convenience of the iteration of the database definition version and simultaneously reduces the labor cost of database management.
It should be noted that, in the implementation of the apparatus for generating a database schema definition statement according to the present invention, the details are already described in the above method for generating a database schema definition statement, and therefore, the repeated contents are not described again here.
FIG. 5 illustrates an exemplary system architecture 500 to which the method of generating database schema definition statements or the apparatus for generating database schema definition statements of embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the method for generating the database schema definition statement provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the apparatus for generating the database schema definition statement is generally disposed in the server 505. The method for generating the database schema definition statements provided by the embodiment of the present invention may also be executed by terminal devices 501, 502, 503, and accordingly, the device for generating the database schema definition statements may be disposed in terminal devices 501, 502, 503.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a parsing module, a definition module, and a population module, where the names of the modules do not in some cases constitute a definition of the modules themselves.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: importing a model file, reading the model file to analyze database definition parameters of the model file; the database definition parameters comprise field names, database names and partition definition information; calling a code definition template and generating a field definition code according to the database definition parameters; and filling the field definition code into the code definition template to generate a database schema definition statement.
According to the technical scheme of the embodiment of the invention, because the technical means of analyzing the database definition parameters of the model file, calling the code definition template and generating the field definition codes according to the database definition parameters and filling the field definition codes into the code definition template to generate the database mode definition statements is adopted, the technical problem of high code development difficulty in the prior art is solved. The embodiment of the invention can directly import the universal database logic structure design model file, and obtains the code definition template and the field definition code by analyzing the database definition parameters of the model file, thereby generating the database mode definition statement, reducing the code development difficulty and saving the time for database developers to compile DDL. Therefore, the embodiment of the invention greatly shortens the timeliness and convenience of the iteration of the database definition version and simultaneously reduces the labor cost of database management.
Moreover, the embodiment of the invention also supports interaction with a background test environment, automatically executes an effective process, and the generated database schema definition statement can be submitted to the test environment in one key type to complete the deployment of the database definition, thereby greatly shortening the timeliness and the convenience of the iteration of the database definition version and simultaneously reducing the labor cost of database management.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of generating a database schema definition statement, comprising:
importing a model file, reading the model file to analyze database definition parameters of the model file; the database definition parameters comprise field names, database names and partition definition information;
calling a code definition template and generating a field definition code according to the database definition parameters;
and filling the field definition code into the code definition template to generate a database schema definition statement.
2. The method of claim 1, wherein the model file is an XML file that is exported by a data modeling tool, and wherein the model file comprises a structure of database tables and an index structure of the database tables.
3. The method of claim 1, wherein invoking a code definition template and generating a field definition code according to the database definition parameters comprises:
matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information;
and calling a corresponding code definition template according to the database name and the partition definition information.
4. The method of claim 3, wherein prior to reading the model file, further comprising:
updating the model file in response to configuration information entered by a user.
5. An apparatus for generating a database schema definition statement, comprising:
the analysis module is used for importing a model file and reading the model file so as to analyze the database definition parameters of the model file; the database definition parameters comprise field names, database names and partition definition information;
the definition module is used for calling a code definition template according to the database definition parameters and generating field definition codes;
and the filling module is used for filling the field definition codes into the code definition template so as to generate the database schema definition statement.
6. The apparatus of claim 5, wherein the model file is an XML file that is output by a data modeling tool, and wherein the model file comprises a structure of database tables and an index structure of the database tables.
7. The apparatus of claim 5, wherein the definition module is further configured to:
matching corresponding type definition information according to the field name and the database name, and generating a field definition code according to the type definition information;
and calling a corresponding code definition template according to the database name and the partition definition information.
8. The apparatus of claim 5, wherein the parsing module is further configured to:
and before reading the model file, responding to configuration information input by a user, and updating the model file.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201911347549.7A 2019-12-24 2019-12-24 Method and device for generating database schema definition statement Active CN111125064B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911347549.7A CN111125064B (en) 2019-12-24 2019-12-24 Method and device for generating database schema definition statement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911347549.7A CN111125064B (en) 2019-12-24 2019-12-24 Method and device for generating database schema definition statement

Publications (2)

Publication Number Publication Date
CN111125064A true CN111125064A (en) 2020-05-08
CN111125064B CN111125064B (en) 2023-08-29

Family

ID=70501790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911347549.7A Active CN111125064B (en) 2019-12-24 2019-12-24 Method and device for generating database schema definition statement

Country Status (1)

Country Link
CN (1) CN111125064B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767266A (en) * 2020-05-15 2020-10-13 杭州传化智能制造科技有限公司 Entity contact model design method and device, computer equipment and storage medium
CN111966687A (en) * 2020-08-18 2020-11-20 中国银行股份有限公司 Method and device for partitioning database table of mainframe DB2
CN112632072A (en) * 2020-12-24 2021-04-09 浪潮软件科技有限公司 Method and device for generating C-format NR database table information based on VB
CN113779945A (en) * 2020-08-20 2021-12-10 北京沃东天骏信息技术有限公司 Method and device for generating file

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106354515A (en) * 2016-09-26 2017-01-25 杭州杉石科技有限公司 SystemC code generation system based on model
CN106873949A (en) * 2015-12-11 2017-06-20 泰康保险集团股份有限公司 Code generating method and its device
CN107368346A (en) * 2017-07-06 2017-11-21 万惠投资管理有限公司 A kind of code generating method and device based on metadata and script engine
CN107908394A (en) * 2017-11-21 2018-04-13 中国电子科技集团公司第五十四研究所 A kind of data interchange format source code generation method and instrument
CN108268253A (en) * 2017-05-05 2018-07-10 平安科技(深圳)有限公司 Interface code generation method and terminal device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106873949A (en) * 2015-12-11 2017-06-20 泰康保险集团股份有限公司 Code generating method and its device
CN106354515A (en) * 2016-09-26 2017-01-25 杭州杉石科技有限公司 SystemC code generation system based on model
CN108268253A (en) * 2017-05-05 2018-07-10 平安科技(深圳)有限公司 Interface code generation method and terminal device
CN107368346A (en) * 2017-07-06 2017-11-21 万惠投资管理有限公司 A kind of code generating method and device based on metadata and script engine
CN107908394A (en) * 2017-11-21 2018-04-13 中国电子科技集团公司第五十四研究所 A kind of data interchange format source code generation method and instrument

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767266A (en) * 2020-05-15 2020-10-13 杭州传化智能制造科技有限公司 Entity contact model design method and device, computer equipment and storage medium
CN111767266B (en) * 2020-05-15 2024-08-06 杭州睿疆科技有限公司 Entity connection model design method, entity connection model design device, computer equipment and storage medium
CN111966687A (en) * 2020-08-18 2020-11-20 中国银行股份有限公司 Method and device for partitioning database table of mainframe DB2
CN111966687B (en) * 2020-08-18 2024-04-16 中国银行股份有限公司 Mainframe DB2 database table partitioning method and device
CN113779945A (en) * 2020-08-20 2021-12-10 北京沃东天骏信息技术有限公司 Method and device for generating file
CN112632072A (en) * 2020-12-24 2021-04-09 浪潮软件科技有限公司 Method and device for generating C-format NR database table information based on VB
CN112632072B (en) * 2020-12-24 2023-04-07 浪潮软件科技有限公司 Method and device for generating C-format NR database table information based on VB

Also Published As

Publication number Publication date
CN111125064B (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN110019350B (en) Data query method and device based on configuration information
CN111125064B (en) Method and device for generating database schema definition statement
CN111177231A (en) Report generation method and report generation device
US20210208854A1 (en) System and method for enhancing component based development models with auto-wiring
US10977011B2 (en) Structured development for web application frameworks
CN111414350B (en) Service generation method and device
CN109726217B (en) Database operation method, device, equipment and storage medium
CN110895471A (en) Installation package generation method, device, medium and electronic equipment
CN113760948A (en) Data query method and device
US20220284371A1 (en) Method, device and medium for a business function page
CN108108986B (en) Design method and device of customer relationship management system and electronic equipment
CN113419789A (en) Method and device for generating data model script
CN110109983B (en) Method and device for operating Redis database
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN112579151A (en) Method and device for generating model file
CN113760240B (en) Method and device for generating data model
US20170161359A1 (en) Pattern-driven data generator
CN113515306A (en) System transplanting method and device
CN113312053A (en) Data processing method and device
CN111177183B (en) Method and device for generating database access statement
CN113778501B (en) Code task processing method and device
US20240152511A1 (en) Transliteration of machine interpretable languages for enhanced compaction
CN115981657A (en) Code generation method and device, electronic equipment and readable medium
CN118467503A (en) Database object migration method, apparatus, device, medium and program product
CN116610706A (en) Data blood-edge analysis method, server and system

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
TA01 Transfer of patent application right

Effective date of registration: 20220926

Address after: 25 Financial Street, Xicheng District, Beijing 100033

Applicant after: CHINA CONSTRUCTION BANK Corp.

Address before: 25 Financial Street, Xicheng District, Beijing 100033

Applicant before: CHINA CONSTRUCTION BANK Corp.

Applicant before: Jianxin Financial Science and Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant