Study FAQ
How do I preserve NULLs, empty strings, and data types in a Snowflake export?
Also asked as 2
- What CSV and Parquet settings protect data fidelity in a Snowflake unload?
- How do I keep missing values, empty text, timestamps, and numbers distinct after a Snowflake export?
Answer
Choose an output format and test it with the actual reader. For CSV, give SQL NULL a representation the receiver can distinguish from an empty string. For Parquet, check the physical column types and explicitly handle Snowflake values that do not map directly.
- CSV. Use
FIELD_OPTIONALLY_ENCLOSED_BYto quote string fields and aNULL_IFtoken that cannot collide with valid data. Agree on whether empty strings appear as quoted empty text, how the reader applies the null convention, delimiter, headers, UTF-8 handling, date and timestamp rendering, and compression. Keep the compression and filename extension consistent. If emitting unquoted empty fields withEMPTY_FIELD_AS_NULL = FALSE, keep an explicit distinct null token and apply the corresponding rules on reload. - Parquet. It preserves a typed columnar schema, but Snowflake's unload maps fixed-point numbers to DECIMAL and can serialize VARIANT values as JSON strings.
COPY INTO <location>documents restrictions on unloadingTIMESTAMP_TZorTIMESTAMP_LTZdirectly to Parquet. Convert them explicitly to an agreed UTC timestamp or offset-bearing text and verify the consumer's interpretation. Check the actual timestamp precision and decimal range after the round trip.
Test NULL and empty text separately, including a literal that resembles the null token, embedded delimiters, quotes, newlines, Unicode, large numbers, and timestamps at the precision and time zone your workload uses.
Supported unload formats and options · CSV null handling and Parquet type conversion · Snowflake date and time types
Full explanation
Unloading Data and Building Reliable Export Workflows
Study guide · COF-C03
Read the full explanation