I'm using sqldump-to by arjunmehta to get the sql dump from mysql in to a json file to load that into big query.

When i run the package on my table. I'm getting unable to parse string error on the command line. But the output file is generated. In the output file the column names are shifted right and the first name is always "[" and the last column name is missing and the last column value is tagged to prev column name because of shifting.

I'm new to the java script. I'm unable to debug the error. Can you please help me with identifying the problem?

Error log in cli: Also the error seems to appear for multiple rows. lineNumber is always 1 but the columnNumber changes.

Unable to parse string ['US','USD','Spring',2023,'2022-12-09','S23 AMA Supercross VLP 9-Dec-22.xlsx','SUPERCROSS',NULL,'','','REFRESH',null,'DIE CAST','Vehicles','65702','6066278',null,'GML ',null,'1:24 Die Cast - NEON Solid Pack',4.49,'SOLID (omni compliant)','YES',null,null,'GLOBAL','NO','No','No',null,null,'1  die cast bike w/ attached rider,1 race gate stand, 1 collector poster ',5,'Blister Card','Yes','4+','NO','Vietnam',null,null,'ON SHELF:1/1/2023',null,null,0.00,0.00,0.00,'2023-07-11']
SyntaxError: JSON5: invalid character 'U' at 1:93
    at syntaxError (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\json5\lib\parse.js:1110:17)
    at invalidChar (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\json5\lib\parse.js:1055:12)
    at literal (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\json5\lib\parse.js:722:19)
    at Object.value (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\json5\lib\parse.js:298:13)
    at lex (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\json5\lib\parse.js:100:42)
    at Object.parse (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\json5\lib\parse.js:25:17)
    at SQLSignalParserWriter.handleData (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\lib\sql-signal-parser-writer.js:73:28)
    at Transform.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\lib\write-worker-child.js:11:12)
    at Transform.emit (node:events:517:28)
    at addChunk (C:\Users\xxx\AppData\Roaming\npm\node_modules\sqldump-to\node_modules\readable-stream\lib\_stream_readable.js:279:12) {
  lineNumber: 1,
  columnNumber: 93

** The output data looks like **

{"[":"US","Country":"USD","Currency":"Spring","Season":2023,"Year":"2022-10-24","File_Date":"S23 MNJ_MJC VLP 24-Oct-22.xlsx"

and the output schema file looks like

[
  {
    "name": "["
  },
  {
    "name": "Country",
    "type": "varchar(10)"
  },
  {
    "name": "Currency",
    "type": "varchar(10)"
  },

this is the code that i'm running to get the dumps in json format

mysqldump --column-statistics=0  -u uname -p -h hostname price vlp_raw | sqldump-to -d C:\Users\xxxx\Downloads\output --schema
0

There are 0 best solutions below