#EWI: SPRKPY1027 => pyspark.sql.readwriter.DataFrameReader.json has a workaround, see documentation for more infostringmap = sparkSession.read.json(path, primitiveAsString=True, dateFormat="2023-06-20")
Scenario:
json(
#Pathpath,
#Schemaschema=None,
#OptionsprimitivesAsString=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:
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 [email protected]. If you have a contract for support with Snowflake, reach out to your sales engineer and they can direct your support needs.