Skip to content

skip non insert lines without error #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions mysqldump_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ def main():
try:
for line in fileinput.input():
# Look for an INSERT statement and parse it.
if not is_insert(line):
raise Exception("SQL INSERT statement could not be found!")
values = get_values(line)
if not values_sanity_check(values):
raise Exception("Getting substring of SQL INSERT statement after ' VALUES ' failed!")
parse_values(values, sys.stdout)
if is_insert(line):
values = get_values(line)
if values_sanity_check(values):
parse_values(values, sys.stdout)
else:
print('failed to parse line' + line)
else:
print('not a insert line' + line)
except KeyboardInterrupt:
sys.exit(0)

Expand Down