我用了
CREATE [OR REPLACE] [[GLOBAL] TEMPORARY] VIEW
创建一些视图。我想展示所有观点。
以下命令不起作用。
show views
但是当我使用的时候
show tables
结果包括视图。我感到很困惑
这个article有助于理解如何在Azure Databricks中使用“视图”。
例子:
-- Create a persistent view view_deptDetails in database1. The view definition is recorded in the underlying metastore
CREATE VIEW database1.view_deptDetails
AS SELECT * FROM company JOIN dept ON company.dept_id = dept.id;
-- Create or replace a local temporary view from a persistent view with an extra filter
CREATE OR REPLACE TEMPORARY VIEW temp_DeptSFO
AS SELECT * FROM database1.view_deptDetails WHERE loc = 'SFO';
-- Access the base tables through the temporary view
SELECT * FROM temp_DeptSFO;
-- Create a global temp view to share the data through different sessions
CREATE GLOBAL TEMP VIEW global_DeptSJC
AS SELECT * FROM database1.view_deptDetails WHERE loc = 'SJC';
-- Access the global temp views
SELECT * FROM global_temp.global_DeptSJC;
-- Drop the global temp view, temp view, and persistent view.
DROP VIEW global_temp.global_DeptSJC;
DROP VIEW temp_DeptSFO;
DROP VIEW database1.view_deptDetails;
这个article有助于理解如何在Azure Databricks中使用“show tables”。
例:
SHOW TABLES [{FROM|IN} db_name] [LIKE 'pattern']
希望这可以帮助。