automated data import to mysql server with file versioning python script
files = set()
for table in owner_tables:
if table not in exclude_tables:
print('Exporting table: %s' % table)
query1 = 'SELECT ' + table + '.* INTO OUTFILE "' + path + 'tables/' + table + '.sql" FROM ' + table + ' JOIN ' \
+ table + '_owner USING(' + table + '_id) WHERE ' + table + '_owner.scroll_version_id < 1058'
cursor.execute(query1)
print('Exporting table: %s_owner' % table)
query2 = 'SELECT * INTO OUTFILE "' + path + 'tables/' + table + '_owner.sql" FROM ' + table + '_owner WHERE ' \
+ table + '_owner.scroll_version_id < 1058'
cursor.execute(query2)
files.add(path + table + '.sql')
files.add(path + table + '_owner.sql')
for table in non_owner_tables:
if table not in exclude_tables:
query3 = 'SELECT ' + table + '.* INTO OUTFILE "' + path + 'tables/' + table + '.sql" FROM ' + table
cursor.execute(query3)
files.add(path + table + '.sql')