When the above wrapper function is applied, the data is imported normally and validated and published as expected.
Running job on an empty Snowflake dataset fails
If you run a job on an 0-row dataset that is sourced from Snowflake, the job execution fails.
- The underlying issue is that when the 0-row dataset is unloaded from Snowflake to S3, no file is created. Therefore, there is no dataset object to wrangle.
- For more information, see https://community.snowflake.com/s/question/0D50Z00009JKB9gSAH/wanted-unload-empty-file-with-header
The solution is to union the empty dataset row with an empty row. Example:
SELECT col1, col2 FROM empty_table UNION ALL SELECT '' AS col1, '' AS col2 FROM empty_table;
The insert row values prevent the job from failing.