MSCEWI3105

Additional work is needed for BFILE column usage. BUILD_STAGE_URL function is a recommended workaround

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Low

Description

The transformation for BFILE datatype is VARCHAR. However, the translation for the Oracle built-in functions used to interact with BFILE types is currently not supported. The column is migrated to a VARCHAR in order to store the file path and name (check the BFILENAME_UDF documentation for more information).

The BUILD_STAGE_FILE_URL function is a recommended workaround to work with files in Snowflake. It will return a link to the specified file stored in a stage. Check the function documentation here.

Example Code

Input Code:

CREATE TABLE bfiletable ( bfile_column BFILE );

INSERT INTO bfiletable VALUES ( BFILENAME('mydirectory', 'myfile.png') );

Output Code:

CREATE OR REPLACE TABLE PUBLIC.bfiletable ( bfile_column VARCHAR /*** MSC-WARNING - MSCEWI1036 - BFILE DATA TYPE CONVERTED TO VARCHAR ***/
/*** MSC-WARNING - MSCEWI3105 - ADDITIONAL WORK IS NEEDED FOR BFILE COLUMN USAGE. BUILD_STAGE_FILE_URL FUNCTION IS A RECOMMENDED WORKAROUND ***/);

INSERT INTO PUBLIC.bfiletable VALUES (/*** MSC-WARNING - MSCEWI1020 - CUSTOM UDF 'BFILENAME_UDF' INSERTED. ***/
PUBLIC.BFILENAME_UDF('mydirectory', 'myfile.png') );

Recommendations

  • Use the BUILD_STAGE_FILE_URL and the other file functions to handle files.

--Example stage
CREATE OR REPLACE TEMPORARY STAGE my_stage;

--Usage Example
SELECT BUILD_STAGE_FILE_URL(@my_stage,'/mydirectory/myfile.jpg') URL;

This function works with different cloud storage options, but for information regarding using local files with stages, check this documentation.

Last updated