为什么我不能从 azure data studio 或 databricks 查询突触无服务器视图?
Why can't i query synapse serverless view from azure data studio or databricks?
当我从 synpase studio 查询我的 delta table 时,我可以看到数据都很好。
但是当我通过 sql 登录(或数据块)连接到 data studio 时,我似乎无法查询它:
CREATE or alter view stock
as SELECT *
FROM
OPENROWSET(
BULK 'https://tesdvsrc18732.dfs.core.windows.net/adlse-fr/be_stock/',
FORMAT = 'DELTA'
) AS [result]
Started executing query at Line 1 Msg 15151, Level 16, State 1, Line 1
Cannot find the CREDENTIAL
'https://tesdvsrc18732.dfs.core.windows.net/adlse-fr/be_stock/',
because it does not exist or you do not have permission. Total
execution time: 00:00:00.025
我也看不到 UI 中的视图:
不过,如果通过 Azure Active Directory 连接,我可以看到它。
如有任何建议、意见或专业知识,我们将不胜感激。
我从 azure databricks
收到了同样的错误信息
我找到了一种方法来做我想做的事。所以我把它贴在这里。
在突触上
CREATE MASTER KEY
CREATE DATABASE SCOPED CREDENTIAL [SasToken_MyStorage]
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = '?sv=2020-08-04&ss=bfq****************************************************************************************************************************************************PA%3D';
GO
CREATE EXTERNAL DATA SOURCE [MyDataSource]
WITH ( LOCATION = 'https://tesdvsrc18732.dfs.core.windows.net',
CREDENTIAL = [SasToken_MyStorage]
)
我觉得也需要这个,但不确定:
GRANT CONTROL ON DATABASE SCOPED CREDENTIAL :: [SasToken_MyStorage] TO userDatabricks
在 databricks/data 工作室
query = """
CREATE or alter view dbo.stock
as SELECT *
FROM
OPENROWSET(
BULK '/adlse-fr/be_stock/',
FORMAT = 'DELTA',
DATA_SOURCE = 'MyDataSource'
) AS [result]
"""
stmt = sql_con.createStatement()
stmt.executeUpdate(query)
stmt.close()
当我从 synpase studio 查询我的 delta table 时,我可以看到数据都很好。
但是当我通过 sql 登录(或数据块)连接到 data studio 时,我似乎无法查询它:
CREATE or alter view stock
as SELECT *
FROM
OPENROWSET(
BULK 'https://tesdvsrc18732.dfs.core.windows.net/adlse-fr/be_stock/',
FORMAT = 'DELTA'
) AS [result]
Started executing query at Line 1 Msg 15151, Level 16, State 1, Line 1 Cannot find the CREDENTIAL 'https://tesdvsrc18732.dfs.core.windows.net/adlse-fr/be_stock/', because it does not exist or you do not have permission. Total execution time: 00:00:00.025
我也看不到 UI 中的视图:
不过,如果通过 Azure Active Directory 连接,我可以看到它。
如有任何建议、意见或专业知识,我们将不胜感激。 我从 azure databricks
收到了同样的错误信息我找到了一种方法来做我想做的事。所以我把它贴在这里。
在突触上
CREATE MASTER KEY
CREATE DATABASE SCOPED CREDENTIAL [SasToken_MyStorage]
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = '?sv=2020-08-04&ss=bfq****************************************************************************************************************************************************PA%3D';
GO
CREATE EXTERNAL DATA SOURCE [MyDataSource]
WITH ( LOCATION = 'https://tesdvsrc18732.dfs.core.windows.net',
CREDENTIAL = [SasToken_MyStorage]
)
我觉得也需要这个,但不确定:
GRANT CONTROL ON DATABASE SCOPED CREDENTIAL :: [SasToken_MyStorage] TO userDatabricks
在 databricks/data 工作室
query = """
CREATE or alter view dbo.stock
as SELECT *
FROM
OPENROWSET(
BULK '/adlse-fr/be_stock/',
FORMAT = 'DELTA',
DATA_SOURCE = 'MyDataSource'
) AS [result]
"""
stmt = sql_con.createStatement()
stmt.executeUpdate(query)
stmt.close()