Open enaix opened 2 years ago
i use the code below to skip 42 lines .
` def main(): """ Parse arguments and start the program """
# listed in sys.argv[1:]
# or stdin if no args given.
try:
counter = 0
for line in fileinput.input():
counter += 1
if counter >= 43 :
# 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)
except KeyboardInterrupt:
sys.exit(0)
`
JIC here is the related PR #5
Made a pull request to skip it in PR #8
It seems that the repo is dead.. Idk, it might be reasonable to create a fork or contact the owner
Thanks to the guys above, you saved my task
"SQL INSERT statement could not be found!" check is performed on all lines, in case if there is header data in the sql file, the script will refuse to process it. Skipping this line or disabling the exception until the first INSERT line is found are possible solutions.