pyspark.sql.readwriter.DataFrameReader.json has a workaround




This issue appears when the tool detects the usage of pyspark.sql.readwriter.DataFrameReader.json which has a workaround.
Input code:
stringmap =, primitiveAsString=True, dateFormat="2023-06-20")
Output code:
#EWI: SPRKPY1027 => pyspark.sql.readwriter.DataFrameReader.json has a workaround, see documentation for more info
stringmap =, primitiveAsString=True, dateFormat="2023-06-20")


#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:
stringmap =["./data/file1.json", "./data/file2.json"])
stage = f'{sparkSession.get_fully_qualified_current_schema()}.{_generate_prefix("TEMP_STAGE")}'
sparkSession.sql(f'CREATE TEMPORARY STAGE IF NOT EXISTS {stage}').show()
sparkSession.file.put(f"file://./data/file1.json", f"@{stage}")
sparkSession.file.put(f"file://./data/file2.json", f"@{stage}")
stringmap =
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:
stringmap =, schema)
stringmap =
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:
stringmap =, primitiveAsString=True, dateFormat="2023-06-20")
stringmap ="dateFormat", "2023-06-20").json(path)
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.


  • 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.