SPRKPY1075

The expected result might be different if the schema doesn't match.

Category

Warning.

Description

The parse_json does not apply schema validation, if you need to filter/validate based on schema you might need to introduce some logic.

Example

Input

df.select(from_json(df.value, Schema))
df.select(from_json(schema=Schema, col=df.value))
df.select(from_json(df.value, Schema, option))

Output

#EWI: SPRKPY1075 => The parse_json does not apply schema validation, if you need to filter/validate based on schema you might need to introduce some logic.
df.select(parse_json(df.value))
#EWI: SPRKPY1075 => The parse_json does not apply schema validation, if you need to filter/validate based on schema you might need to introduce some logic.
df.select(parse_json(df.value))
#EWI: SPRKPY1075 => The parse_json does not apply schema validation, if you need to filter/validate based on schema you might need to introduce some logic.
df.select(parse_json(df.value))

For the function from_json the schema is not really passed for inference it is used for validation. See this examples:

Example 1: Enforce Data Types and Change Column Names:

Example 2: Select Specific Columns:

Recommendations

  • For more support, you can email us at [email protected]. If you have a contract for support with Snowflake, reach out to your sales engineer and they can direct your support needs.

  • Useful tools PEP-8 and Reindent.

Last updated