dataengref migrate

Home / Redshift

Redshift JSON_EXTRACT_PATH_TEXT in Snowflake, Databricks and BigQuery

Snowflake keeps the name JSON_EXTRACT_PATH_TEXT but takes a single dotted path instead of separate path elements. Databricks uses get_json_object and BigQuery JSON_VALUE, both with a $.a.b path.

Redshift function: JSON_EXTRACT_PATH_TEXT('json_string', 'path_elem' [, 'path_elem' ...] [, null_if_invalid]) · Redshift docs

Equivalents

TargetSupportSyntaxNotesSource
SnowflakeDifferent nameJSON_EXTRACT_PATH_TEXT(column, 'a.b')One path string in dotted notation, for example 'customer.address.city'; returns NULL when the path does not exist.Snowflake docs
DatabricksRewriteget_json_object(expr, '$.a.b')Returns NULL when the path is missing. For new code Databricks recommends VARIANT columns and the : operator.Databricks docs
BigQueryRewriteJSON_VALUE(json_string, '$.a.b')Returns a scalar as STRING; use JSON_QUERY for objects and arrays.BigQuery docs

Behavior differences to check

Examples

City from a JSON payload

Redshift
SELECT JSON_EXTRACT_PATH_TEXT(payload, 'customer', 'city') AS city FROM events;
Snowflake
SELECT JSON_EXTRACT_PATH_TEXT(payload, 'customer.city') AS city FROM events;
Databricks
SELECT get_json_object(payload, '$.customer.city') AS city FROM events;
BigQuery
SELECT JSON_VALUE(payload, '$.customer.city') AS city FROM events;

Other Redshift functions

Last checked: · Paste a whole query into the SQL checker to find every function that needs a change.