首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在U-SQL表中插入JSON模式

在U-SQL表中插入JSON模式
EN

Stack Overflow用户
提问于 2018-05-17 02:51:51
回答 1查看 82关注 0票数 1

我想在DataLake Analysts tool中为我的U-SQL表插入JSON schema。这是我的JSON模式

代码语言:javascript
复制
DECLARE @json string=  "{
        "definitions": {},
        "$schema": "http://json-schema.org/draft-06/schema#",
        "$id": "http://getIQOS.com/IQOSAbandonedCartV1.json",
        "title": "CE:I:ORD:ABC",
        "type": "object",
        "properties": {
            "altriaOrchestrated": {
                "$id": "/properties/altriaOrchestrated",
                "type": "integer",
                "title": "Altria Orchestrated",
                "description": "Specifies whether the AT object is being called by Core Services (1) or from an outside source (0)",
                "default": 0,
                "enum": [
                    0, 1
                ],
                "examples": [
                    0, 1
                ],
                "minimum": 0,
                "maximum": 1
            },
        "required": [
            "altriaOrchestrated",
            "initiativeName",
            "date",
            "inventory"
        ]
     }"

我得到下面的错误,不能理解它是什么错误。因为这个问题,我的开发停止了。

代码语言:javascript
复制
 AGG ALL AND ARRAY BETWEEN BIGINT BIT BINARY BY COLUMNSET CREATED CSHARP CURRENT DATETIME DATETIME2 DECIMAL EXISTS FILE FLOAT FOLLOWING GROUP IN INT IS LENGTH LCID MAP MAX MODIFIED MONEY NULL NVARCHAR OR OVER PARTITION PRECEDING REAL SMALLINT SQL STRUCT TINYINT UNBOUNDED UNIQUEIDENTIFIER VARBINARY VARCHAR WITHIN string-literal numeric-literal character-literal punctuation-mark identifier quoted-identifier reserved-identifier variable system-variable '[' ']' '(' '{' '}' '=' '.' '*' ':' '?' '<' '>'
EN

回答 1

Stack Overflow用户

发布于 2018-06-11 14:32:35

根据我的测试,您可以使用双引号和反斜杠声明json字符串参数,如下所示。

代码语言:javascript
复制
DECLARE @json string ="{"+
        "\"definitions\": {},"+
        "\"$schema\": \"http://json-schema.org/draft-06/schema#\","+
        "\"$id\": \"http://getIQOS.com/IQOSAbandonedCartV1.json\","+
        "\"title\": \"CE:I:ORD:ABC\","+
        "\"type\": \"object\","+
        "\"properties\": {"+
            "\"altriaOrchestrated\": {}"+
        "}"+
"}";

此外,您还可以利用逐字C#字符串文字,通过在字符串的开始双引号前面添加@字符来简化此类字符的处理。对于json字符串,可以按如下方式声明它:

代码语言:javascript
复制
DECLARE @json string =@"{
        ""definitions"": {},
        ""$schema"": ""http://json-schema.org/draft-06/schema#"",
        ""$id"": ""http://getIQOS.com/IQOSAbandonedCartV1.json"",
        ""title"": ""CE:I:ORD:ABC"",
        ""type"": ""object"",
        ""properties"": {
           ""altriaOrchestrated"": {}
        }
}";

备注:

在U-SQL中,string类型的列的最大大小为128kB (基于以UTF8编码表示的字符串值的字节计数)。

详情请关注Textual Types and Literals

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50378105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档