Coder Social home page Coder Social logo

mysql-insert-csv's People

Contributors

thebenforce avatar

Watchers

 avatar  avatar

mysql-insert-csv's Issues

Fails to convert certain string fields

The field parsing seems to be a bit broken when parsing a CSV file. If a string field contains a " (quote followed by a space), the field is not properly terminated by a closing ' character. I ran into this issue where there are some text fields that refer to measurements like 1/2" and the SQL generated was improperly formatted. Here's an example:
14463,NULL,00536991501,INSULIN SYRINGE/NEEDLE (generic MONOJECT INSULIN SYRINGE),DOES NOT APPLY,MISC,MISC,28G X 1/2" 1 ML,97051030906370,INSULIN SYRINGE/NEEDLE,INSULIN SYRINGE/NEEDLE U-100,N,G,B,0,1,0
However, the SQL generated for this line is:
(14463,NULL,'00536991501','INSULIN SYRINGE/NEEDLE (generic MONOJECT INSULIN SYRINGE)','DOES NOT APPLY','MISC','MISC','28G X 1/2\" 1 ML,97051030906370,INSULIN SYRINGE/NEEDLE,INSULIN SYRINGE/NEEDLE U-100,N,G,B,0,1,0\n14464,NULL,00536993001,EASY TOUCH INSULIN SYRINGE,DOES NOT APPLY,MISC,MISC,31G X 5/16\" 1 ML,97051030906387,EASY TOUCH INSULIN SYRINGE,INSULIN SYRINGE/NEEDLE U-100,N,T,B,0,1,0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
Note that this is also including the following line, but the closing quotes enclose other fields. This appears to be an issue whenever quotes are escaped as part of the string, rather than enclosing a string field (that includes a comma). I suspect this is just being incorrectly parsed.

Add progress callback

Instead of always writing progress to the console, allow the user to specify a callback method that will receive the current percentage completed.

Column transformer

On instantiation, allow the user to pass in an object specifying transformer methods for specific columns.

Unable to parse Excel generated CSVs

Excel seems to leave some non-displayable characters whenever it generates a new CSV file. Saving an existing CSV through excel does not seem to do this. This becomes an issue because these characters are interpreted to be part of the header and this utility fails to match (there is a stray '?' character that doesn't appear in the original CSV).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.