【发布时间】:2020-09-13 08:55:18
【问题描述】:
我正在 SQL Server 2019 中针对 Azure CosmosDB (MongoDB API) 设置 Polybase,但我无法创建外部表。
我在 Cosmos DB 中创建了一个示例文档,其定义如下:
{
"_id" : ObjectId("5ecc3fcd7791b617982fefa0"),
"id" : "1",
"products" : "2009",
"item" : "Car",
"type" : "Racecar"
}
Snipped from Azure portal for sample collection
当我运行以下语句时:
CREATE EXTERNAL TABLE mongodb.Products
(
[_id] NVARCHAR(24) COLLATE Latin1_General_CI_AS NOT NULL,
[id] NVARCHAR(10) COLLATE Latin1_General_CI_AS,
[products] NVARCHAR(10) COLLATE Latin1_General_CI_AS,
[item] NVARCHAR(10) COLLATE Latin1_General_CI_AS,
[type] NVARCHAR(10) COLLATE Latin1_General_CI_AS
)
WITH (
LOCATION='Sales.Products',
DATA_SOURCE= CosmosDB
);
我收到一条消息:
Msg 105083, Level 16, State 1, Line 1
105083;The following columns in the user defined schema are incompatible with the external table schema for table 'Products': user defined column: 'id' was not found in the external table, user defined column: 'products' was not found in the external table, user defined column: 'item' was not found in the external table, user defined column: 'type' was not found in the external table. The detected external table schema is: ([_id] NVARCHAR(24) COLLATE Latin1_General_100_CI_AS NOT NULL).
连接似乎不错。如果我更改 Sales.Product,我将收到一条消息,指出表不存在。
【问题讨论】:
-
Latin1_General_CI_AS与Latin1_General_100_CI_AS的排序规则不同。尽管理论上它们都是代码页 1252,但它们会处理一些字母,例如Ǹ和ǹdifferently。
标签: sql-server mongodb azure-cosmosdb polybase