SnowflakeSQLException: SQL compilation error: Object $$ does not exist or not authorized.

  • Post author:
  • Post category:Snowflake
  • Post last modified:February 24, 2020

While accessing the Snowflake table from Apache Spark, getting “SnowflakeSQLException” with error message Object “table name” does not exist or not authorized.

net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error:
Object ‘EMPLOYEE’ does not exist or not authorized.

Out of many, one fo the reason for this error is due to the table not having appropriate access for the user. On Snowflake console, please check the role for the selected database, schema and table individually.

And by providing "sfRole" -> "ACCOUNTADMIN" as an option, you should able to access the database and table successfully.


var sfOptions = Map(
    "sfURL" -> "https://oea81082.us-east-1.snowflakecomputing.com/",
    "sfAccount" -> "oea81082",
    "sfUser" -> "nnkumar13",
    "sfPassword" -> "Nelamalli#1",
    "sfDatabase" -> "EMP",
    "sfSchema" -> "PUBLIC",
    "sfRole" -> "ACCOUNTADMIN"
  )

  val df: DataFrame = spark.read
    .format("net.snowflake.spark.snowflake")
    .options(sfOptions)
    .option("dbtable", "EMPLOYEE")
    .load()

Leave a Reply