On Oct 26, 8:05 am, Russell Keith-Magee <[email protected]> wrote: > On Tue, Oct 26, 2010 at 12:01 PM, David Lindquist > > <[email protected]> wrote: > > I was wondering what the prospect was of getting a CSV serializer > > added to Django. It seems like it would be useful for many use cases, > > especially for bulk editing of objects by non-technical users. We have > > this requirement where I work, so I wrote a CSV serializer: > >http://djangosnippets.org/snippets/2240/. It would be nice to get > > something like this in Django. I see that there was some effort a > > while back in ticket #5253 (http://code.djangoproject.com/ticket/ > > 5253), but it looks like it has sort of died on the vine. I'd be happy > > to submit my code, but I don't want to step on any toes if something > > is already in progress. Would it be appropriate to open a new ticket? > > A new ticket isn't required -- the feature request hasn't > fundamentally changed. I'm also not aware of any work in progress in > this area. > > The fundamental issue that hit the last CSV serializer effort was > demonstrating that the serialization format that was being proposed > was actually viable, and suffciently 'common' that it was appropriate > for the core. Formats like JSON, XML, and YAML have a fundamentally > agreed structure for representing complex data, and while Django's > serializer uses a particular set of formatting conventions, the JSON > data is parseable by any JSON compliant parser. CSV has a basic > structure (i.e., comma separated values), but doesn't have a natural > way of representing multiple datatypes, multiple values for a single > field, or differentiating NULL from empty string. Even in-file > metadata (sometimes represented as the first, commented out row of a > CSV file) is the subject of inconsistency. > > For a serializer to land in trunk, it needs to be clear that the > proposed serializer would produce output in a format that will be > immediately and obviously useful by other consumers -- e.g., that > Django-genereated CSV output would be useful (and meaningful) as input > to Excel. So far, I haven't seen a proposed format that would meet > this criterion. > > Instead of introducing a specific CSV serializer to Django, my > preference would be to improve the serialization framework such that > implementing a CSV serializer could be a relatively simple > configuration exercise, rather than a major engineering effort. This > is obviously a lot more work than just introducing a single new > serializer, but I think it would ultimately yield a lot more useful > outcomes -- not the least of which would be providing a way to get > CSV-serialized output without needing to dictate a single output > format. > > Yours, > Russ Magee %-)
Thanks Russ for your detailed, well-reasoned response. What you said about CSV having a basic structure but inconsistencies in other areas is something I ran up against when I started investigating this. Sounds like a general solution is still a ways off. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
