From f1ec8ded5d549da980608be57ab9459486e97efd Mon Sep 17 00:00:00 2001 From: Charlie Duso Date: Wed, 29 Jun 2016 00:46:49 -0700 Subject: [PATCH] Added two test databases for user to try the merge before tampering with their files. --- mergeScript.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/mergeScript.py b/mergeScript.py index 47063fa..48fc98f 100644 --- a/mergeScript.py +++ b/mergeScript.py @@ -10,11 +10,13 @@ ################################################################################ import sqlite3 +import time +import datetime ############################ Global Variables ################################## ################################################################################ -dbCount = 1 # Variable to count the number of databases +dbCount = 0 # Variable to count the number of databases ############################ Function Definitions ############################## ################################################################################ @@ -49,7 +51,7 @@ def getTableNames(): # Gets the column names of a table # # @param dbName the name of the database file (i.e. "example.db") -# @return a string array of the column names - strips primary ids +# @return a string array of the column names - strips primary ids def getColumnNames( tableName ): curs.execute("PRAGMA table_info(%s);" % str(tableName)) temp = curs.fetchall() @@ -66,7 +68,7 @@ def getColumnNames( tableName ): # # @param list1 the first list parameter for comparison # @param list2 the second list parameter for comparison -# @return will return a boolean (0 lists !=, 1 lists ==) +# @return will return a boolean (0 lists !=, 1 lists ==) def compareLists(list1, list2): if len(list1) != len(list2): return 0 @@ -87,9 +89,9 @@ def mergeTable(tableName, columnNames, dbNameTableName): curs.execute("INSERT INTO %s (%s) SELECT %s FROM %s;" % (tableName, columnNames, columnNames, dbNameTableName)) conn.commit() - -############################## Merge Script #################################### + +############################## Input Parameters ################################ ################################################################################ # Create the initial database connection - everything will be merged to here @@ -97,8 +99,16 @@ conn = sqlite3.connect('') # Enter the name of the database curs = conn.cursor() # Creates a cursor for use on the database # Attach databases - attachDatabase('') # Enter the name of the database (i.e. "example.db") attachDatabase('') attachDatabase('') attachDatabase('') + +############################## Merge Script #################################### +################################################################################ + +# Compare databases + +# Merge databases +print("Merging databases. Started at: " + time.time()) +print("Databases finished merging. Time elapsed: ")