On Wed, Jun 26, 2013 at 12:35:55PM +0200, Nißl Reinhard scratched on the wall:

> well we could discuss endlessly, what well formed CSV files are.
> Given that we cannot fix the generation of the CSV file, why not
> making the importer a little bit smarter?

  The standard answer to this is, "Go ahead."

  The relative simplicity of the .import command is an issue that comes
  up every year or so on this list.  We've been through this before a
  half-dozen times.  Everyone seems convinced it would be really easy
  and really simple to make just one small change so that the importer
  works with their version CSV.

  Unfortunately, when you actually start to dig in and make such
  changes, they're rarely simple.  Making it better in one way often
  breaks it in other ways.  Thanks to the poorly defined standard
  (or, rather, the fact there are so many different standards) there
  is no easy way out of this, and it quickly turns into a really,
  really complex issue.  If it was simple, it would also be simple to
  write a program that converted files into a format that .import was
  happy with.

  

  At the end of the day, I'd MUCH rather have the SQLite team working
  on database features than on support commands in the shell.  If you
  feel the change is simple, easy, and won't break any existing
  behaviors, feel free to submit a patch.

  A year or so ago there was some effort to write a plug-in that would
  use the standard Python CSV module (at least, I think it was Python)
  for data import into SQLite.  The Python module is pretty good at
  importing most flavors of CSV... and as a result is an extremely
  complex bit of code.  Anyone know if that project got any traction?



> All I ask for is to treat an odd number of " in a cell as literal data
> except when the rule for dequoting applies, i. e. when the cell starts
> with a ".

  Sounds simple, except for the fact that quotes also help define cell
  boundaries (in cases when the data value has a comma).  It isn't about
  even or odd quotes because you don't know where the cells start and
  stop until you untangle the quotes.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to