โ06-07-2022 02:27 AM
I'm having issues trying to read temporary views in SQL Analytics module. Ive managed to create temporary views based on a query but I don't know how to read from them? Just using the name of the view returns "Table or view not found".
โ06-07-2022 02:44 AM
@Daniel Alteborgโ , Temp views are visible only to the session created and are dropped when the session ends.
I guess that is your issue here.
โ06-07-2022 02:55 AM
No, I'm actually having issues reading from the view in the same session that created it. Using the same view name I get a table or view not found.
โ06-07-2022 02:58 AM
Strange,
did you create the view as follows:
CREATE TEMPORARY VIEW IF NOT EXISTS view
AS ...
(If you are on community edition this feature might not be available, can't tell.)
โ06-07-2022 07:54 AM
So this is interesting, I tried to run the CREATE query per your example above:
CREATE TEMPORARY VIEW IF NOT EXISTS view_test AS
select * from ....
But this gave me a exception:
"It is not allowed to define a TEMPORARY view with IF NOT EXISTS"
However, I used a similar query before to create my view:
CREATE OR REPLACE TEMPORARY VIEW view_test AS
select * from ....
This works fine, the query returns: "was successfully executed" but I cant use the view becouse it's not found.
โ06-07-2022 07:55 AM
I should be able to read the view with "select * from view_test"?
โ06-07-2022 07:59 AM
@Daniel Alteborgโ, hm ok,
https://docs.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-syntax-ddl-create-view
so it should work.
Maybe you do not have the necessary permissions?
โ06-15-2022 03:11 AM
I havn't been able to resolve the issue. I'm using a admin account in databricks so it should't be a permission issue?
Is there any sample dataset that I can use in sql analytics so that I can try again and share my specific code here?
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!
Sign Up Now