【问题标题】:SQL Server 2019 Polybase MongoDB user defined column was not found in the external table在外部表中找不到 SQL Server 2019 Polybase MongoDB 用户定义列
【发布时间】: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_ASLatin1_General_100_CI_AS 的排序规则不同。尽管理论上它们都是代码页 1252,但它们会处理一些字母,例如 Ǹǹ differently

标签: sql-server mongodb azure-cosmosdb polybase


【解决方案1】:

我终于能够解决这个问题。如果您尝试连接到 Azure CosmosDB Mongo DB API,您似乎需要在 SQL Server 中编辑一个文件。

您需要找到 C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn\Polybase\ODBC Drivers\PolyBase ODBC Driver for MongoDb.ini

改两行

发件人(不起作用): Driver=MongoDb\2.3.8\MongoDBODBCsb64.dll 的 PolyBase ODBC 驱动程序 Setup=MongoDb\2.3.8\MongoDBODBCsb64.dll 的 PolyBase ODBC 驱动程序

致(作品) Driver=MongoDb\MongoDBODBCsb64.dll 的 PolyBase ODBC 驱动程序 Setup=MongoDb\MongoDBODBCsb64.dll 的 PolyBase ODBC 驱动程序

这是 Microsoft 支持团队提供的解决方案。

【讨论】:

    猜你喜欢
    • 2020-06-22
    • 2021-10-16
    • 2020-03-31
    • 2019-08-29
    • 2019-04-24
    • 2022-01-02
    • 2019-12-17
    • 1970-01-01
    • 2016-09-25
    相关资源
    最近更新 更多