1

我一直在尝试构建我的 U-SQL 脚本,甚至使用了下面的示例:

CREATE ASSEMBLY IF NOT EXISTS [Newtonsoft.Json] FROM      "assemblies/Newtonsoft.Json.dll";
CREATE ASSEMBLY IF NOT EXISTS [Microsoft.Analytics.Samples.Formats] FROM "assemblies/Microsoft.Analytics.Samples.Formats.dll";

REFERENCE ASSEMBLY [Newtonsoft.Json];
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats];

DECLARE @INPUT_FILE string = @"/Samples/Data/json/donut.json";

//Extract the sps property from the Json file as a string.
    @json =
EXTRACT sps string
FROM @INPUT_FILE
USING new Microsoft.Analytics.Samples.Formats.Json.JsonExtractor();

@json =
    SELECT sps.Replace("\r\n", "") AS sps
    FROM @json;


/*
Parse the sps property to extract the id and name values as a SQL.MAP
*/
@sps_json = 
    SELECT Microsoft.Analytics.Samples.Formats.Json.JsonFunctions.JsonTuple(sps, "$..id") AS sp_id_map, 
       Microsoft.Analytics.Samples.Formats.Json.JsonFunctions.JsonTuple(sps, "$..type") AS sp_type_map
FROM @json;

/*
Explode the id and type maps to get the values of the Id and type as individual rowsets
*/

@sps_id_property =
SELECT id_name.Split('.')[0] AS id_name,
       id_value
FROM @sps_json
     CROSS APPLY
         EXPLODE(sp_id_map) AS T(id_name, id_value);
@sps_type_property =
SELECT type_name.Split('.')[0] AS type_name,
       type_value
FROM @sps_json
     CROSS APPLY
         EXPLODE(sp_type_map) AS T(type_name, type_value);

/*
JOIN the Id and Value maps to return the properties as a rowset

Output of the following JOIN statement
1001,Regular
1002,Chocolate
1003,Blueberry
1004,Devil's Food
*/
@sps = SELECT [id].id_value AS id, [type].type_value AS type
                              FROM @sps_id_property AS [id]
                              INNER JOIN @sps_type_property AS [type]
ON id.id_name == type.type_name;

  /* 
  Output the file.
  */

  OUTPUT @sps
  TO "/rukmanig/output/sps.csv"
  USING Outputters.Csv(quoting : false);

但是,当我构建它时,我收到以下错误:

E_CSC_USER_NOTAUTHORIZED:此语句需要数据库“master”的 USE 权限

我不知道为什么我有这个。我的另一位同事在构建同一个项目时没有问题。我以前能够建造,但由于某种原因我不能再建造了。

有人知道为什么吗?

谢谢。

4

1 回答 1

0

我假设你已经能够修复它。但是在我们引入文件和文件夹以及数据库级别的 ACL 之后,现有帐户上的现有用户需要被授予对主数据库的显式权限。

新添加的用户或新创建的帐户应该自动完成。

于 2016-10-10T20:21:25.503 回答