File size: 722 Bytes
f742815
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

import re

file_path = 'attendr.sql'

with open(file_path, 'r', encoding='utf-8') as f:
    content = f.read()

# Replace "table_name" with `table_name` in INSERT INTO statements
# Regex looks for: INSERT INTO "word"
# Replaces with: INSERT INTO `word`
# Or I can just remove the quotes since table names are safe. Let's remove them to be safe across different modes if possible, but backticks are safer for MySQL.
# Let's use backticks.

def replace_quotes(match):
    return f'INSERT INTO `{match.group(1)}`'

new_content = re.sub(r'INSERT INTO "([^"]+)"', replace_quotes, content)

with open(file_path, 'w', encoding='utf-8') as f:
    f.write(new_content)

print("Fixed quotes in attendr.sql")