Read

org.apache.spark.sql.SparkSession.read=> com.snowflake.snowpark.Session.sql

Reader transformation consists on replace equivalent methods. Also, transformations add EWIs to not supported methods and also for unsupported or not required options.

Methods supported by Snowpark are: avro, csv, json, option, options, orc, parquet, schema, table, xml. See here.

Options supported by Snowpark are: query, which value is used as a parameter to the sql method.

Input Code:

sparkSession.read.
      format("net.snowflake.spark.snowflake").
      option("sfUrl", s"https://$ACCOUNT.snowflakecomputing.com:443").
      option("sfAccount", "test_account").
      option("sfUser", "test_user").
      option("sfPassword", "test_pass").
      option("sfSchema", "test_schema").
      option("sfDatabase", "test_db").
      option("sfWarehouse", "test_wh").
      option("sfRole", "test_role").
      option("query", s"select * from $tablename").load()

Output Code:

sparkSession.sql(s"select * from $tablename")
      /*EWI: SPRKSCL1108 => Reader format value is not supported.format("net.snowflake.spark.snowflake")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfUrl", s"https://$ACCOUNT.snowflakecomputing.com:443")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfAccount", "test_account")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfUser", "test_user")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfPassword", "test_pass")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfSchema", "test_schema")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfDatabase", "test_db")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfWarehouse", "test_wh")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("sfRole", "test_role")
      EWI: SPRKSCL1109 => Reader option is not supported.
      option("query", s"select * from $tablename")
      /*EWI: SPRKSCL1112 => Function org.apache.spark.sql.DataFrameReader.load is not supported*/
      .load()*/

Last updated