Nov-05-2019, 07:38 AM
Hello,
I modify your code and it goes well now.
try this:
I modify your code and it goes well now.
try this:
def parse_sql(sql_file_path): with open(sql_file_path, 'r', encoding='utf-8') as f: data = f.read().splitlines() stmt = '' stmts = [] for line in data: if line: if line.startswith('--'): continue stmt += line.strip() + ' ' if ';' in stmt: stmts.append(stmt.strip()) stmt = '' return stmts