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:ย 

Query Serverless SQL Warehouse from Spark Submit Job

akhileshp
New Contributor III

I am trying to load data from a table in SQL warehouse using spark.sql("SELECT * FROM <table>") in a spark submit job, but the job is failing with [TABLE_OR_VIEW_NOT_FOUND] The table or view . The same statement is working in notebook but not in a job. How to query the SQL warehouse from the spark job.

5 REPLIES 5

I am running the spark job in databricks, so it is running in databricks runtime itself then why is the behaviour different with the notebook and a spark submit job

Wojciech_BUK
Valued Contributor III

Hey,
Is your table in Unity Catalog or in Hive Metastore ?
just my guess(es):

- use full table path Catalog_name.Schema_Name.Table_name (maybe you had some context saved when querying data interactively. 

- if your table is in UC - is your Job Cluster running in UC enabled mode (single / shared) ? 

From your post it is bit uncleare where and what you are running. 

The table is in hive_metastore and I am using the full path.

The job compute is created using an instance pool

Wojciech_BUK
Valued Contributor III

- when you query table manually and running job - do both those actions happens in same Databricks Workspace
- what is job configuration - who is job Owner or Run As Account -> do this principal/persona has access to the table ?

Yes, Both are in the same workspace and querying same table

Yes the principle has all the access.

Also its working with spark python job, the problem is with spark submit job only.

My usecase is supported only in submit job since I am having multiple scripts in a zip file

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group