使用ConnectorX通过Windows集成认证读取SQL Server数据至Polars DataFrame时触发SourceNotSupport("MsSQL")错误的求助
使用ConnectorX通过Windows集成认证读取SQL Server数据至Polars DataFrame时触发SourceNotSupport("MsSQL")错误的求助
大家好,我最近在Rust项目里尝试用ConnectorX读取SQL Server的数据到Polars DataFrame,但卡在了Windows集成认证这一步,每次运行代码都会抛出这个错误:
Query failed: SourceNotSupport("MsSQL")
我的代码如下(注:我修正了代码里的几处小笔误,比如函数缺少返回类型、变量名拼写错误):
main.rs
use polars::prelude::*; use connector::prelude::*; fn main(){ let bs_df: DataFrame = create_df_connectorx(); println!("{:?}", bs_df); } fn create_df_connectorx() -> DataFrame { let connection_str: &str = "mssql://sample_servername/sample_databasename?integratedSecurity=true"; let source_conn: SourceConn = SourceConn::try_from(connection_str).expect("failed to create connection"); let queries: &[CXQuery;1] = &[CXQuery::from("select * from sample_tablename")]; // 错误出现在这一行 let destination: Arrow2Destination = connectorx::get_arrow2::get_arrow2( &source_conn, None, queries).expect("Query failed"); let df: DataFrame = destination.polars().unwrap(); df }
Cargo.toml
[package] name="query_sqlserver" version="0.1.0" edition="2021" [dependencies] connectorx={version="^0.3.3", features=["dst_arrow2"]} polars={version="0.32"}
我还没试过用账号密码的方式连接,因为公司数据库默认都是用Windows认证登录的。我搜了相关的内容,但没找到任何用ConnectorX结合Windows集成认证读取MSSQL数据的示例,甚至不确定ConnectorX现在是否支持这种认证方式。有没有大佬能帮我看看问题出在哪?
备注:内容来源于stack exchange,提问作者Frank Yang
相关产品推荐
相关产品推荐

