SPRKPY1027
pyspark.sql.readwriter.DataFrameReader.json has a workaround
Category
Warning.
Description
This issue appears when the tool detects the usage of pyspark.sql.readwriter.DataFrameReader.json which has a workaround.
Input code:
Output code:
Scenario:
json(
#Path path,
#Schema schema=None,
#Options primitivesAsString=None, prefersDecimal=None, allowComments=None, allowUnquotedFieldNames=None, allowSingleQuotes=None, allowNumericLeadingZero=None, allowBackslashEscapingAnyCharacter=None, mode=None, columnNameOfCorruptRecord=None, dateFormat=None, timestampFormat=None, multiLine=None, allowUnquotedControlChars=None, lineSep=None, samplingRatio=None, dropFieldIfAllNull=None, encoding=None, locale=None, pathGlobFilter=None, recursiveFileLookup=None, allowNonNumericNumbers=None, modifiedBefore=None, modifiedAfter=None ) Several workarounds are possible in this scenario. Path: The first parameter "path" must be a stage to make an equivalence with Snowpark, so is recommended to implement a temporary stage and add each ".json" path to the stage, using the prefix "file://", as follows. Source:
Expected:
Schema: The second parameter "schema" is not supported for Snowpark as a parameter, so you have to specify it, if it does not have an schema yet, use the schema function, as follows: Source:
Expected:
Options: The additional parameters are also not supported by Snowpark as parameters, but for many of them you can use the "option" function to specify those .json parameters as options, as follows: Source:
Expected:
The following options are not supported for Snowpark: timeZone, primitiveAsString, prefersDecimal, allowComments, allowUnquotedFieldNames, allowSingleQuotes, allowNumericLeadingZero, allowBackslashEscapingAnyCharacter, mode, columnNameOfCorruptRecord, timestampNTZFormat, multiline, allowUnquotedControlChars, encoding, lineSep, samplingRatio, dropFiledIfAllNull, locale, allowNonNumericNumbers, ignoreNullFields.
Recommendation
For more support, you can email us at snowconvert-info@snowflake.com. If you have a contract for support with Snowflake, reach out to your sales engineer and they can direct your support needs.
Last updated