โ12-03-2020 12:50 PM
Hey All,
So Iโm trying to load certain columns from a csv file into snowflake, but facing some issues.
I have the file, properly parsed it via the csv parser, and Iโve also used a mapper to map the columns properly. However, I need snaplogic to be able to do tell snowflake, if the entry in this row says โ(null)โ or โ(None)โ to treat it as a NULL insert in the bulk load.
Is there a way to do this?
For example, say I have a snowflake DB with column that accepts only 1 char, a Y or N. The row from the dataset has a โ(null)โ as the entry for that column, which is causing an issue since it is > 1 char. Is there a way for snaplogic to understand โ(null)โ means NULL and insert a NULL into snowflake via the bulk load snap?
Thank you!
โ12-03-2020 03:12 PM
Just curious If you have checked this option Load empty strings on the Snowflake Bulk load Snap.
โ12-03-2020 03:43 PM
@amubeen There are two ways that you can handle this use case
2.The null values coming from a csv parser will be a string. A condition in the mapper to convert the null String values to null will work:
$NULLABLECHAR == โnullโ ? null : $NULLABLECHAR
cc: @robin
โ12-10-2020 02:21 PM
@amubeen Were you able to resolve your issue with the above information ?
โ12-11-2020 01:05 PM
Hi @amubeen,
Youโd better use multiple checks when it comes to nulls from csv file. It can be an empty string, or NULL or null or Null or (null), , etc.
One way is this:
($NULLABLECHAR == โโ || $NULLABLECHAR.toLowerCase().indexOf(โnullโ) > -1) ? null : $NULLABLECHAR
However, settings can help you also, but if you fully trust the csv incoming data (e.g. always having null, but not (null) which is different)
/Igor