cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL compilation error while connecting to snowflake from Databricks

Kaviprakash_S
New Contributor III

Hi All,

I'm trying to connect to the snowflake database from databricks notebook either to read the data or write the data. However I'm getting an weird error. The code and error are provided as follows,

 

snowflake_table = (spark.read
  .format("snowflake")
  .option("host", "******.east-us-2.azure.snowflakecomputing.com")
  .option("user", "******")
  .option("password", "*********")
  .option("sfWarehouse", "Compute_WH")
  .option("database", "SalesDevDB")
  .option("schema", "gold") # Optional - will use default schema "public" if not specified.
  .option("dbtable", "test")
  .load()
)


Error:
 
net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error:
 
Kaviprakash_S_0-1717986833387.png

 

 
3 REPLIES 3

brickster_2018
Esteemed Contributor
Esteemed Contributor

Can you try the below code snippet? And share the stacktrace if the issue persists. 

snowflake_table = spark.read \
  .format("snowflake") \
  .option("host", "******.east-us-2.azure.snowflakecomputing.com") \
  .option("user", "******") \
  .option("password", "*********") \
  .option("sfWarehouse", "Compute_WH") \
  .option("database", "SalesDevDB") \
  .option("schema", "gold") \
  .option("dbtable", "test") \
  .load()

 

 

I don't think adding the "\" will work in this case. Infact its not required in this dataframe operation. 

Kaviprakash_S
New Contributor III

@Kaniz Could you please help with this ? 

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!