Error when trying to load an empty file

:1234: version:

2.2.0


Please tell us about your environment where the above product is running:

  • Operating System:
    Windows Server 2016 Standard
    10.0.14393 build 14393
  • Is this running in a virtual machine:
    Yes
    • If answered yes above, which virtual machine environment and version:
      Not sure

:hushed: Current Behavior:

When trying to load an empty file, it produces console output as index of of range and the exit code is not 0. The empty file was generated from SQL Sever bulkloader tool (BCP)

The error is being logged as a failure into a Snowflake task log table even though an empty file loading causes no harm to the load process.

Data Loader generated the following error when trying to load the empty file:

2021-06-17 11:06:53,946 - Application - INFO - Application started.
2021-06-17 11:06:53,946 - Application - INFO - Connecting to Snowflake Database
2021-06-17 11:06:54,789 - Application - INFO - Resuming Warehouse data_load_wh
2021-06-17 11:06:54,992 - Application - INFO - Statement executed successfully.
2021-06-17 11:06:54,992 - Application - INFO - Starting Transaction FILE_UPLOAD
2021-06-17 11:06:54,992 - Application - INFO - CREATING TRANSACTION FILE_UPLOAD
2021-06-17 11:06:55,305 - Application - INFO - Statement executed successfully.
2021-06-17 11:06:55,508 - Application - INFO - SKIPPING EMPTY FILE: BI.dbo.LU_Mileage.csv
2021-06-17 11:06:55,508 - Application - ERROR - Exception  ::  list index out of range
2021-06-17 11:06:55,508 - Application - ERROR - Exception  ::  list index out of range
2021-06-17 11:06:55,914 - Application - INFO - Statement executed successfully.
snowflake_uploader.exe --file g:\bcp_export_qa\BI.dbo.LU_Mileage.csv --sf_account xxx --sf_username svr_lz_load --sf_password xxxx --sf_database lz_qa --sf_schema bi --sf_warehouse data_load_wh --sf_role SYSADMIN_qa --sf_table LU_Mileage --sf_file_format lz_qa.CONTROL.FF_UTF_8 --split_file --sf_stage_type TABLE --remove_split_dir --use_upload_dir --synchronous

:thinking: Expected Behavior:

Data Loader should allow loading empty file without exiting as error


πŸ’ Possible Solution:


:flashlight: Context:

Data Loader was being invoked as a shell command and the output of the command line is being logged into a Snowflake task log table. Any errors will be reported at the end of the loader execution.


:computer: Examples / Screenshots:

While I do see the two ERROR lines, right above the first ERROR we can see that the Data Loader did properly identify that it’s an EMPTY FILE as stated by this line: 2021-06-17 11:06:55,508 - Application - INFO - SKIPPING EMPTY FILE: BI.dbo.LU_Mileage.csv

However, while the lines following may be a little misleading and we’ll investigate to correct - they are in fact harmless beyond showing in the console / log.

Further, both the Windows and Linux executable do return an ERRORLEVEL code that is not 0 where an exception is raised that can be leveraged.

Can you elaborate on what the ask / expected behavior should be? And please do follow the requested new topic template for posting reports in this category.

@lzhang can you confirm that in your example use case, per the console log you provided and the CLI switches, that the source file BI.dbo.LU_Mileage.csv itself was empty, not one of the split files. Correct?

@lzhang Data Loader pre-release of 2.3.0 contains a fix for this. Please test this pre-release and let me know if this resolves the issue.