mysqldump-to-csv icon indicating copy to clipboard operation
mysqldump-to-csv copied to clipboard

Cannot process file due to csv header data

Open enaix opened this issue 3 years ago • 5 comments

"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.

enaix avatar Aug 08 '22 10:08 enaix

i use the code below to skip 42 lines .

def main(): """ Parse arguments and start the program """ # Iterate over all lines in all files # 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)

deter3 avatar Jun 09 '23 23:06 deter3

JIC here is the related PR #5

enaix avatar Jun 15 '23 08:06 enaix

Made a pull request to skip it in PR #8

JohnPremKumar avatar Jun 20 '23 10:06 JohnPremKumar

It seems that the repo is dead.. Idk, it might be reasonable to create a fork or contact the owner

enaix avatar Jun 21 '23 08:06 enaix

Thanks to the guys above, you saved my task

sblvkr avatar Feb 20 '24 18:02 sblvkr