FORMATMESSAGE_UDF

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Snowflake does not have a function with the functionality of FORMATMESSAGE. SnowConvert generates the following Python UDF to emulate the behavior of FORMATMESSAGE.

CREATE OR REPLACE FUNCTION FORMATMESSAGE_UDF(MESSAGE STRING, ARGS ARRAY)
RETURNS STRING
LANGUAGE python
IMMUTABLE
RUNTIME_VERSION = '3.8'
HANDLER = 'format_py'
as
$$
def format_py(message,args):
  return message % (*args,)
$$;

This UDF may not work correctly on some cases:

  • Using the %I64d placeholder will throw an error.

  • If the number of substitution arguments is different than the number of place holders, it will throw an error.

  • Some unsigned placeholders like %u or %X will not behave properly when formatting the value.

  • It cannot handle message_ids.

Last updated