CN105630898A - Method applicable to switch application database table data version - Google Patents

Method applicable to switch application database table data version Download PDF

Info

Publication number
CN105630898A
CN105630898A CN201510961362.1A CN201510961362A CN105630898A CN 105630898 A CN105630898 A CN 105630898A CN 201510961362 A CN201510961362 A CN 201510961362A CN 105630898 A CN105630898 A CN 105630898A
Authority
CN
China
Prior art keywords
version
database table
switching
data
table data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201510961362.1A
Other languages
Chinese (zh)
Inventor
马桂成
杨松
季统凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
G Cloud Technology Co Ltd
Original Assignee
G Cloud Technology 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 G Cloud Technology Co Ltd filed Critical G Cloud Technology Co Ltd
Priority to CN201510961362.1A priority Critical patent/CN105630898A/en
Publication of CN105630898A publication Critical patent/CN105630898A/en
Withdrawn legal-status Critical Current

Links

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/219Managing data history or versioning

Abstract

The present invention relates to the technical field of application database management, in particular to a method applicable to switch an application database table data version. The method disclosed by the present invention comprises: firstly calling a database table data version switching command; loading a database script language file list; analyzing the file list and obtaining a latest version; obtaining the current database table data version; analyzing whether parameters in the command contain a version parameter, and if the version parameter is comprised, setting the version required to be switched as the latest version; and finally executing data base table data version switching. The method disclosed by the present invention effectively solves the problem of automatic switch of the application database table data version, and is applicable to the application database table data version management.

Description

A kind of method suitable in the switching of application database table versions of data
Technical field
The present invention relates to application database management technique field, particularly a kind of method suitable in the switching of application database table versions of data.
Background technology
In the project testing stage of some software system developments, the data base in system has generally had a lot of table and data, and Test Engineer is required for performing database table versions of data is updated operation every day. It is all generally the one or more of execution SQL SQL files of manual execution or statement, sometimes find to need database table data is demoted when current version is unavailable, it is also required to equally this time perform one or more of execution SQL SQL file or statement, and statement or the sql file upgrading and demote are different, bring problems with:
One is that manual execution is easily made mistakes, and the execution of SQL file or statement usually has sequencing, perform in a certain order, and is easy to occur omitting perform file.
If two is the degradation across multiple versions, Developmental Engineer writes the workload required for these SQL files or statement greatly, and efficiency is low;
Three are SQL file or catalogue disunity that statement is deposited, it is difficult to carrying out unified management, version manager personnel to pass through inquiring about colophon could position what change is specifically certain edition data storehouse table data done on earth.
In order to avoid makeing mistakes of artificially performing, alleviate the work complexity that database table versions of data is switched by Test Engineer, Developmental Engineer has only to be absorbed in upgrading or the down method of current database table versions of data, needing a kind of method suitable in the switching of application database table versions of data, user has only to simply perform an order and can be achieved with database table data edition upgrading or degraded operation.
Summary of the invention
Present invention solves the technical problem that and be in that to provide a kind of method suitable in the switching of application database table versions of data, solve that artificial application database table versions of data performs easily to make mistakes, Test Engineer performs SQL file that loaded down with trivial details complicated, the Developmental Engineer's exploitation again of database table data version switch operating switches across multiple versions or statement workload is complicated, SQL file or the problem such as statement management is unified not.
This invention address that the technical scheme of above-mentioned technical problem is:
Comprise the steps:
Step 1: call database table data version switching command;
Step 2: loading of databases script language files list;
Step 3: Study document list also obtains up-to-date version;
Step 4: obtain the version of current database table data;
Step 5: whether the parameter analyzed in order comprises Release parameter, if including, performs step 7, if not including performing step 6;
Step 6: arrange need switching version be latest edition;
Step 7: if desired switching version then performs step 8 less than current database table versions of data; If desired switching version then performs step 9 more than current database table versions of data; If desired switching version then performs step 10 equal to current database table versions of data;
Step 8: perform database table data version degradation; Perform step 11;
Step 9: perform database table data edition upgrading; Perform step 11;
Step 10: any operation need not be done;
Step 11: complete.
The described order calling database table data version switching command has only to an at most parameter: need switching version, it is also possible to do not provide any parameter.
Described loading of databases script language files list is to load all of listed files under specified path, and these file formats are NUM_XXX_YYY_ZZZ.py; Wherein NUM is the version in database table data storehouse, and NUM is made up of numeral, such as 001 (representing the 1st version), 0133 (representing the 133rd version), 3244 (representing the 3244th version) etc.; XXX, YYY, ZZZ are user-defined English or the character string of numeral composition. Each .py file only includes upgrading and two methods of degradation, and the upgrade method of All Files is the same with the name of down method;
The file of described .py form, is the formatted file of Python programmed scripts language;
Described Python, is a kind of object-oriented, explanation type computer programming language, it is not necessary to compiling just can direct execution script language.
Described Study document list also obtains up-to-date version, is the version number that explains that each file is corresponding of the file name from listed files, and maximum version number is exactly up-to-date version;
The described version obtaining current database table data is the version inquiring this database table data from database table data.
Whether the described parameter analyzed in order comprises Release parameter, is explain in the order line that user calls whether include Release parameter, if then explaining its value and arranging that to need switching version be its value; Then perform next step if not.
Described arrange that to need switching version be latest edition, arrange that to need switching version be up-to-date version, listed files namely analyzes up-to-date version.
Compare during described step 7 and need switching version and current database table versions of data size, then select upgrading, degradation or do not do any operation.
Described execution database table data version degradation, is by current database table versions of data, needs switching version order, the down method of execution database script language file from highest version to lowest version, complete version switching flow; Described down method, it is common that by deletion table, to delete list structure field, arrange certain field be default value, changes the length of field or type etc., also has less situation to be to increase table, increase list structure field;
Described execution database table data edition upgrading, is by current database table versions of data, needs switching version order, the upgrade method of execution database script language file from lowest version to highest version, complete version switching flow; Described upgrade method is usually increase table, increases list structure field, arranges certain field is default value, the length changing field or type etc., also has less situation to be deletion table, delete list structure field.
The present invention is by the method suitable in the switching of application database table versions of data, solve that artificial application database table versions of data performs easily to make mistakes, Test Engineer performs SQL file that loaded down with trivial details complicated, the Developmental Engineer's exploitation again of database table data version switch operating switches across multiple versions or statement workload is complicated, SQL file or the problem such as statement management is unified not, user performs version switching and has only to perform a simple order. The present invention is a kind of technological frame, the method being different from general database table data version switching; The present invention achieves the goal mainly through SQLAlchemy instrument and grammer thereof, is different from general database table data version switching; The present invention is except being capable of the database table data edition upgrading commonly used, moreover it is possible to fulfillment database table versions of data is demoted, and the method for the database table data version switching that region is general can not realize versions of data degradation; The present invention has only to user and performs a simple order, and being different from the switching of other database table data versions needs to perform many more manipulations.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the present invention is further described:
Fig. 1 is flow chart;
Fig. 2 is database script language file exemplary block diagram of the present invention.
Detailed description of the invention
Embodiments of the present invention have multiple, illustrate that one of which realizes method for cloud platform here, and as shown in Figure 1, 2, specific implementation process is as follows:
1, database table data version switching command is called;
As performed order: dbsync027
Wherein 027 represents: needing switching version is the 27th version
2, loading of databases script language files list;
����
Loading of databases script language files list.
Path, parampath file place
Return is without returning an object value
����
Defload (self, path):
self.config.load(path)
3, Study document list obtain up-to-date version;
����
Loading of databases script language files list.
Paramfile_list listed files
Return is without returning an object value
����
Defanalyse (self, file_list):
self.config.analyse(file_list)
4, the version of current database table data is obtained;
����
Loading of databases script language files list.
Path, parampath file place
Return is without returning an object value
����
Defget_max_version (self):
returnself.config.get_max_version()
5, whether the parameter analyzed in order comprises Release parameter
����
Whether the parameter analyzed in order comprises Release parameter.
Path, parampath file place
Return analyzes result
����
Defparse_args (self, args=None):
returnself.config.parse_args(args)
6, arrange need switching version be latest edition;
����
Arrange need switching version be latest edition
Parammax_version latest edition
Return is without returning an object value
����
Defset_version (self, max_version):
self.config.set_version(max_version)
7, if desired switching version then performs degradation flow process less than current database table versions of data; If desired switching version then performs upgrading flow process more than current database table versions of data; If desired switching version then need not do any operation equal to current database table versions of data;
����
Scheduling flow.
Paramversion needs switching version
Paramdb_version current database table versions of data
Return is without returning an object value
����
Defdispath (self, version, db_version):
Self.db.dispath (version, db_version)
8, perform database table data version degradation, complete version switching flow.
����
Perform database table data version degradation.
Paramversion needs switching version
Paramdb_version current database table versions of data
Return is without returning an object value
����
Defdowngrade (self, version, db_version):
Self.db.downgrade (version, db_version)
9, perform database table data edition upgrading, complete version switching flow.
����
Perform database table data edition upgrading.
Paramversion needs switching version
Paramdb_version current database table versions of data
Return is without returning an object value
����
Defupgrade (self, version, db_version):
Self.db.upgrade (version, db_version)
Whole flow process just completes.

Claims (8)

1. the method being applicable to the switching of application database table versions of data, it is characterised in that: comprise the steps:
Step 1: call database table data version switching command;
Step 2: loading of databases script language files list;
Step 3: Study document list also obtains up-to-date version;
Step 4: obtain the version of current database table data;
Step 5: whether the parameter analyzed in order comprises Release parameter, if including, performs step 7, if not including performing step 6;
Step 6: arrange need switching version be latest edition;
Step 7: if desired switching version then performs step 8 less than current database table versions of data; If desired switching version then performs step 9 more than current database table versions of data; If desired switching version then performs step 10 equal to current database table versions of data;
Step 8: perform database table data version degradation; Perform step 11;
Step 9: perform database table data edition upgrading; Perform step 11;
Step 10: any operation need not be done;
Step 11: complete.
2. method according to claim 1, it is characterised in that: described in call the order of database table data version switching command and have only to an at most parameter: need switching version, it is also possible to do not provide any parameter.
3. method according to claim 1, it is characterised in that: described loading of databases script language files list is to load all of listed files under specified path, and these file formats are NUM_XXX_YYY_ZZZ.py; Wherein NUM is the version in database table data storehouse, and NUM is made up of numeral, such as 001 (representing the 1st version), 0133 (representing the 133rd version), 3244 (representing the 3244th version) etc.; XXX, YYY, ZZZ are user-defined English or the character string of numeral composition. Each .py file only includes upgrading and two methods of degradation, and the upgrade method of All Files is the same with the name of down method;
The file of described .py form, is the formatted file of Python programmed scripts language;
Described Python, is a kind of object-oriented, explanation type computer programming language, it is not necessary to compiling just can direct execution script language.
4. method according to claim 1, it is characterised in that: described Study document list also obtains up-to-date version, is the version number that explains that each file is corresponding of the file name from listed files, and maximum version number is exactly up-to-date version;
The described version obtaining current database table data is the version inquiring this database table data from database table data.
5. method according to claim 1, it is characterised in that: whether the described parameter analyzed in order comprises Release parameter, is explain in the order line that user calls whether include Release parameter, if then explaining its value and arranging that to need switching version be its value; Then perform next step if not.
6. method according to claim 1, it is characterised in that: described arranging needs switching version to be latest edition, arranges that to need switching version be up-to-date version, namely analyzes up-to-date version in listed files.
7. method according to claim 1, it is characterised in that: compare during described step 7 and need switching version and current database table versions of data size, then select upgrading, degradation or do not do any operation.
8. the method according to any one of claim 1 to 7, it is characterized in that: described execution database table data version degradation, it is by current database table versions of data, needs switching version order, the down method of execution database script language file from highest version to lowest version, completes version switching flow; Described down method, it is common that by deletion table, to delete list structure field, arrange certain field be default value, changes the length of field or type etc., also has less situation to be to increase table, increase list structure field;
Described execution database table data edition upgrading, is by current database table versions of data, needs switching version order, the upgrade method of execution database script language file from lowest version to highest version, complete version switching flow; Described upgrade method is usually increase table, increases list structure field, arranges certain field is default value, the length changing field or type etc., also has less situation to be deletion table, delete list structure field.
CN201510961362.1A 2015-12-18 2015-12-18 Method applicable to switch application database table data version Withdrawn CN105630898A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510961362.1A CN105630898A (en) 2015-12-18 2015-12-18 Method applicable to switch application database table data version

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510961362.1A CN105630898A (en) 2015-12-18 2015-12-18 Method applicable to switch application database table data version

Publications (1)

Publication Number Publication Date
CN105630898A true CN105630898A (en) 2016-06-01

Family

ID=56045831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510961362.1A Withdrawn CN105630898A (en) 2015-12-18 2015-12-18 Method applicable to switch application database table data version

Country Status (1)

Country Link
CN (1) CN105630898A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649631A (en) * 2016-12-07 2017-05-10 国云科技股份有限公司 System and method for flexibly configuring additional field
CN107220315A (en) * 2017-05-16 2017-09-29 北京酷我科技有限公司 The user data protection method that database degrades during a kind of APP version updatings
CN107861737A (en) * 2017-11-06 2018-03-30 国云科技股份有限公司 A kind of database version moving method of large scale system
CN109189783A (en) * 2018-08-03 2019-01-11 北京涛思数据科技有限公司 A kind of time series data database table structure change processing method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1859180A (en) * 2005-12-13 2006-11-08 华为技术有限公司 Method and system for realizing network terminal equipment configuration automatic updating
CN1991757A (en) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 Method for realizing software updating
CN101499069A (en) * 2008-02-02 2009-08-05 中兴通讯股份有限公司 Internal memory database file updating method and apparatus
CN101925094A (en) * 2009-06-17 2010-12-22 中兴通讯股份有限公司 Updating system and method for network element management system
CN103186468A (en) * 2013-04-10 2013-07-03 华为技术有限公司 Method and device for testing and verifying software upgrading accuracy
CN103246604A (en) * 2013-03-29 2013-08-14 北京京东尚科信息技术有限公司 Soft testing system, soft testing method, controlling device and executing devices
US20140095432A1 (en) * 2012-09-28 2014-04-03 Apple Inc. Schema versioning for cloud hosted databases

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1859180A (en) * 2005-12-13 2006-11-08 华为技术有限公司 Method and system for realizing network terminal equipment configuration automatic updating
CN1991757A (en) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 Method for realizing software updating
CN101499069A (en) * 2008-02-02 2009-08-05 中兴通讯股份有限公司 Internal memory database file updating method and apparatus
CN101925094A (en) * 2009-06-17 2010-12-22 中兴通讯股份有限公司 Updating system and method for network element management system
US20140095432A1 (en) * 2012-09-28 2014-04-03 Apple Inc. Schema versioning for cloud hosted databases
CN103246604A (en) * 2013-03-29 2013-08-14 北京京东尚科信息技术有限公司 Soft testing system, soft testing method, controlling device and executing devices
CN103186468A (en) * 2013-04-10 2013-07-03 华为技术有限公司 Method and device for testing and verifying software upgrading accuracy

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649631A (en) * 2016-12-07 2017-05-10 国云科技股份有限公司 System and method for flexibly configuring additional field
CN107220315A (en) * 2017-05-16 2017-09-29 北京酷我科技有限公司 The user data protection method that database degrades during a kind of APP version updatings
CN107220315B (en) * 2017-05-16 2020-08-25 北京酷我科技有限公司 User data protection method for database degradation during APP version updating
CN107861737A (en) * 2017-11-06 2018-03-30 国云科技股份有限公司 A kind of database version moving method of large scale system
CN109189783A (en) * 2018-08-03 2019-01-11 北京涛思数据科技有限公司 A kind of time series data database table structure change processing method
CN109189783B (en) * 2018-08-03 2023-10-03 北京涛思数据科技有限公司 Time sequence database table structure change processing method

Similar Documents

Publication Publication Date Title
US10042903B2 (en) Automating extract, transform, and load job testing
CN101212362B (en) Automatic testing device and method incorporating a variety of testing tools
US8788542B2 (en) Customization syntax for multi-layer XML customization
US8966465B2 (en) Customization creation and update for multi-layer XML customization
US8560938B2 (en) Multi-layer XML customization
US20090205013A1 (en) Customization restrictions for multi-layer XML customization
US20090204629A1 (en) Caching and memory optimizations for multi-layer xml customization
CN105630898A (en) Method applicable to switch application database table data version
CN102156643A (en) Software integration method and system thereof
CN102118281B (en) Method, device and network equipment for automatic testing
US20220179642A1 (en) Software code change method and apparatus
CN106371881B (en) Method and system for updating program version in server
US20170220613A1 (en) Systems and methods for database orientation transformation
CN108563432A (en) Android application program componentization rapid development method through route configuration
CN105049514B (en) A kind of document down loading method and device
CN105159718A (en) Firmware updating method and device
CN109977099A (en) Database portion arranging method, user equipment, storage medium and device
US20170111207A1 (en) Nfv system and method for linking vnfm
CN103488674A (en) Computing system and method for implementing and controlling thereof
CN115794106A (en) Method and system for analyzing configuration of binary protocol data of rail transit
CN110968569B (en) Database management method, database management device, and storage medium
CN109117173B (en) Configuration file management method based on project version development
CN103064722A (en) Method and system for unified compiling of programs
US11757474B2 (en) Base station station-type replacement method, SDR network management system, base station station-type replacement apparatus and computer-readable storage medium
CN113741966A (en) Method, system, equipment and storage medium for Kickstart file conversion

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20160601