Skip to content
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

Support Ragged Right or Ignore To End of Line #58

Open
ithielnor opened this issue Jul 30, 2019 · 3 comments
Open

Support Ragged Right or Ignore To End of Line #58

ithielnor opened this issue Jul 30, 2019 · 3 comments

Comments

@ithielnor
Copy link

Is your feature request related to a problem? Please describe.
Sometimes the files we get may have schema changes that we are not informed of with new columns added to the end of the file. It would be nice if we could simply ignore everything beyond the last mapped column, or shunt it all into one mapping.

Describe the solution you'd like
There are two potential options here:

mapper.RemainderIgnored(); // for separated value mappers, ignore all remaining columns
mapper.RaggedRightProperty(x => x.Property); // for fixed width mappers, push all remaining data on the line into a single property.

Describe alternatives you've considered
Currently I must map every column, even if I don't care about it.

Additional context

@jehugaleahsa
Copy link
Owner

This is a great idea. Today, I think I accept extra data being on the end of delimited and fixed width files, but I just end up throwing it away. It would be great to introduce a configuration setting to specify how you want to handle these: throw an exception, throw away the extra stuff or keep it in the results somehow.

For delimited, you would have a an array of strings, basically. I could allow you to access those properties in a custom mapper.

For fixed-width, you would just have a single string. Similarly, I could allow access to it in a custom mapper.

@ithielnor
Copy link
Author

I didn't know you accepted trailing data. I seem to recall I got an error when our mapping didn't match the file layout. Maybe that was a few versions back, so I'll have to retest.

I like your suggested solutions too.

@jehugaleahsa
Copy link
Owner

jehugaleahsa commented Jul 31, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants