postgres-copy icon indicating copy to clipboard operation
postgres-copy copied to clipboard

Verbose mode for debugging?

Open nfedyashev opened this issue 4 years ago • 1 comments

First of all, @diogob thanks for this fantastic and very helpful gem!

I have an idea on how this could be for new users because there is a minor issue that I faced myself.

I have pretty messy CSV files that I can not change, so I'm trying various configuration options(mapping, quotes & other configurations).

Eventually, I came up with proper config but each iteration was rather painful because I couldn't understand what's the actual SQL command that's being generated.

I haven't checked the source code but all exceptions were rather cryptic, short/truncated and without full stack trace.

A few examples:

        1: from app/models/public_model.rb:12:in `import'
PG::SyntaxError (ERROR:  zero-length delimited identifier at or near """")
LINE 1: COPY "public_models" ("","","","","","","","","","","","",""...
                              ^
        1: from app/models/public_model.rb:12:in `import'
ArgumentError (invalid byte sequence in UTF-8)
        1: from app/models/public_model.rb:12:in `import'
NoMethodError (private method `gets' called for #<Pathname:/app/dumps/models.csv>)

nfedyashev avatar Feb 05 '20 10:02 nfedyashev

@nfedyashev thanks, this are good points. I haven't worked in this project in a while, but I'll keep this issue open to keep it in mind for future work. Having said that, feel free to send PRs to address these issues, I would gladly help you get it merged.

diogob avatar Feb 08 '20 23:02 diogob