-
hoping to get a little help, because I'm really confusing myself on some of this. The library is great and fast, however I'm seeing the error: which i think is due to the fact that the csv file I'm importing, will represent empty null numeric values as an empty string. how can I easily and quickly set those numeric fields to accept null values for an empty string? the code is var cmd = conn.CreateCommand();
cmd.CommandText =
$"select top 0 {schemaSql} from {destinationCatalog}.{destinationSchemaName}.{destinationTableName}";
var reader = await cmd.ExecuteReaderAsync(_cancellationToken);
var tableSchema = await reader.GetColumnSchemaAsync(_cancellationToken);
await reader.CloseAsync();
await conn.CloseAsync();
var pool = new Sylvan.StringPool();
var options =
new CsvDataReaderOptions
{
Schema = new CsvSchema(schema),
BufferSize = 128000,
HasHeaders = true,
Culture = CultureInfo.InvariantCulture, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Can you create github gist that contains a full repro? It isn't entirely clear to me from your description what the issue is. I suspect that the SQL result set that you are using to define the schema is expecting some numeric column to be non-nullable, where the csv data contains null (empty) values. |
Beta Was this translation helpful? Give feedback.
-
I see, I have a small test app and had the value as a decimal, and it didn't like it, as a double however it does work. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Pushed Sylvan.Data.Csv 1.2.5 to nuget which should fix this issue. |
Beta Was this translation helpful? Give feedback.
Pushed Sylvan.Data.Csv 1.2.5 to nuget which should fix this issue.