Message 396641 - Python tracker (original) (raw)
Okay, I'll reopen this, at least for the discussion of QUOTE_NONNULL. @erdnaxeli please given an example of how PostgreSQL distinguishes between the empty string and None cases. Is it a quoted empty string vs an empty field? If so, modifying @samwyse's original example, is this what you are after?
csv.register_dialect('quote_notnull', quoting=csv.QUOTE_NOTNULL) csv.writer(sys.stdout, dialect='quote_notnull').writerow(['', None, 42]) "",,"42"
? Can you modify the original two patches to restrict to QUOTE_NONNULL?