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

Temporary table names are highlighted as syntax errors in SQL notebooks

mgrave
New Contributor II

See attached screenshot. In my SQL notebook, declare a temporary view:

CREATE OR REPLACE TEMP VIEW tmp_table AS
SELECT ...;
SELECT count(*) FROM tmp_table;
 
The code editor considers tmp_table is not a valid name in that latter SELECT. The reason is:
Could not find "hive_metastore.default.tmp_table"
 
Although it does not prevent me from running successfully my queries, it is annoying as the editor keeps refreshing with those errors every few seconds. Additionally, temporary table names are not picked up by auto-complete, which is frustrating as well.
 
Is there a way to make Databricks understands those tables should be looked up in the hive_metastore, but in the current session?
 
Thanks!
2 REPLIES 2

swethaNandan
Contributor

The issue might be that tmp_table was not registered at the time when editor was looking up for the table name on the account that the create or replace statement  had not yet executed. 

Craig_
New Contributor III

My temp views always show red as well.  Maybe it is something with our specific environment?

I've also noticed, when browsing the catalog from within the notebook, the temp tables are listed but an error is thrown when you try to view the columns of the temp view: "The table or view cannot be found or does not exist."

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