我想在DataLake Analysts tool中为我的U-SQL表插入JSON schema。这是我的JSON模式
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"
]
}"我得到下面的错误,不能理解它是什么错误。因为这个问题,我的开发停止了。
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 '[' ']' '(' '{' '}' '=' '.' '*' ':' '?' '<' '>'发布于 2018-06-11 14:32:35
根据我的测试,您可以使用双引号和反斜杠声明json字符串参数,如下所示。
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字符串,可以按如下方式声明它:
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编码表示的字符串值的字节计数)。
https://stackoverflow.com/questions/50378105
复制相似问题