-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static Fields? #70
Comments
I'm having a very similar issue. It appears that DefaultValue and OverrideValue are only applied when reading the CSV row by row. I need them to be applied for bulkcopy as well. I'm looking at the source, but can't see yet where the issue occurs. |
Hi @bbakermmc |
@HTI-DaraiusKeeka Since there was no response looks like I ended up using a diff framework: REF: private static void ChoEtlDelimitedMethod(CloudBlockBlob blobFile, int fileLogId, IEnumerable<FileDefinitionFieldsDto> fileDefinitionFields, SqlBulkCopy bulkCopy)
{
var config = new ChoCSVRecordConfiguration
{
FileHeaderConfiguration =
{
HasHeaderRecord = true
}
, Delimiter = "|"
, AutoDiscoverColumns = false
, AutoDiscoverFieldTypes = false
, IsDynamicObject = true
, ThrowAndStopOnMissingField = false
};
foreach (var field in fileDefinitionFields.Where(x => x.FieldOrder > 0 && !x.IgnoreColumnFlagBool))
{
config.CSVRecordFieldConfigurations.Add(new ChoCSVRecordFieldConfiguration(field.ColumnName, field.FieldOrder));
}
using (var parser = new ChoCSVReader(blobFile.OpenRead(), config).Select(row =>
{
row.FileLogId = fileLogId.ToString();
return row;
})
.AsDataReader())
{
using (var bc = bulkCopy)
{
bc.WriteToServer(parser);
bc.Close();
bulkCopy.Close();
bulkCopy = null;
}
}
} |
Thank you. |
Is there a way to add static fields?
EX: When loading from file and putting into the DB, we have a FileId that we generate before the insert, so we would want to add this, but it doesnt exist in the file. The code seems to blow up if I try to do it.
ref:
The text was updated successfully, but these errors were encountered: