cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
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
New Contributor III
New Contributor III

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."

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.