export numerical data with quotes from VARCHAR columns

Answered

I was using the multi-values clause example found here

https://www.jetbrains.com/help/datagrip/export-data-in-ide.html

But it looks like this (and the included SQL-Insert-Statements.sql.groovy file) use this code to determine if a column should be quoted 

def skipQuote = value.toString().isNumber() || value == null

The problem with this code is when there are character columns (like VARCHAR) that contain numeric data (like zip codes) but they need to be stored as strings to keep preceding zeros.  The resulting value in the clause lacks the needed quotes.

Is there a way to determine the source column type and do the quoting via that vs the actual value?

1 comment
Comment actions Permalink

Grahn,

You can extend and modify SQL-Insert-Statements.sql.groovy as you need. Furthermore you can write your own extractor.

0

Please sign in to leave a comment.