Commit 689be254 authored by Your Name's avatar Your Name
Browse files

added sql file tests and code to extract the version number as a list

parent dbb51b4f
......@@ -12,6 +12,8 @@ db_host = sys.argv[2]
db_name = sys.argv[3]
db_password = sys.argv[4]
import os
import re
import mysql.connector
from mysql.connector import errorcode
......@@ -26,6 +28,17 @@ try:
data = cursor.fetchone()
print("Current Database version : %s " % data)
#could do a nested for loop hear the regex.findall(f) is of type list
for root, dirs, files in os.walk("SQL_script_directory"):
for f in files:
if f.endswith(".sql"):
regex = re.compile(r'\d+')
test=regex.findall(f)
print(regex.findall(f))
print(type(test))
# print(os.path.join(root, f))
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment