我无法从 SQL Server 2019 Polybase 访问本地 CSV 文件。这是一个简单的 3 列文本文件。我还创建了一个本地系统 DSN(来自 ODBC32 UI)。
我从这里得到了示例代码。但是,链接(cdata)中的驱动程序不是免费的。任何解决此问题的帮助将不胜感激。
create master key encryption by password = 'Polybase2CSV';
create database scoped credential csv_creds
with identity = 'username', secret = 'password';
create external data source csv_source
with (
location = 'odbc://localhost',
connection_options = 'DSN=CustomerDSN', -- this is the DSN name
-- PUSHDOWN = ON | OFF,
credential = csv_creds
);
CREATE EXTERNAL TABLE Customer
(
CUSTOMERID int,
CUSTOMERNAME varchar(250),
DEPARTMENT varchar(250)
) WITH (
LOCATION='customer.txt',
DATA_SOURCE=csv_source
);