nuodb / migration-tools

Migration tools for NuoDB
http://nuodb.github.com/migration-tools/
BSD 3-Clause "New" or "Revised" License
27 stars 10 forks source link

How to load CSV whose entries are empty into columns declared `NOT NULL DEFAULT '' ` ? #19

Closed rbuck closed 11 years ago

rbuck commented 11 years ago

I have a schema that has this column definition:

source VARCHAR ( 255 ) NOT NULL DEFAULT '' ,

And I am trying to load this sort of data:

... ,this,,that,...

Note empty data between this and that. When I use the migrator I get this sort of error:

Failed to load row #0: illegal null in field SOURCE in table BLAH

Might it be that the migrator is interpreting ,, as null, and passing that as NULL to the database?

Is this a bug, or is there a command line option to force it to treat this field, or other such fields as an empty string?

tazija commented 11 years ago

The migrator is consistent with nuoloader in interpreting CSV values. Empty elements in a CSV file are treated as NULL, an empty string is indicated with double quotation marks "

1,2,3,,5 - NULL is assigned to column 4 (because it is specified as an empty element) 1,2,3,"",5 - Empty string is assigned to column 4 (because it is specified with double quotation marks)

rbuck commented 11 years ago

Thx