将R与MacOS上的ODBC驱动程序连接到Athena

发布于 2025-01-19 22:56:51 字数 999 浏览 4 评论 0原文

我正在尝试使用ODBC从R访问Athena的数据。

我通过Brew和Web的Simba Athena ODBC驱动程序安装了UnixoDBC。

当我运行时:

con <- DBI::dbConnect(
  odbc::odbc(),
  Driver = "/Library/simba/athenaodbc/lib/libathenaodbc_sb64.dylib",
  S3OutputLocation = "",
  AwsRegion = Sys.getenv("AWS_DEFAULT_REGION"),
  AuthenticationType = "IAM Credentials",
  UID = Sys.getenv("AWS_ACCESS_KEY_ID"),
  PWD = Sys.getenv("AWS_SECRET_ACCESS_KEY")
)

我有一个错误:

错误:nanodbc/nanodbc.cpp:1021:00000:[unixodbc] [驱动程序 经理]无法打开LIB '/library/simba/athenaodbc/lib/libathenaodbc_sb64.dylib':不档案 找到

了这个文件,肯定存在,为什么UnixoDBC找不到此文件?

我从网络上安装了R和Rstudio,而不是通过Homebrew,这是SessionInfo:

version  R version 4.1.3 (2022-03-10)
os       macOS Monterey 12.2
system   aarch64, darwin20
ui       RStudio
language (EN)
collate  en_US.UTF-8
ctype    en_US.UTF-8
tz       Europe/Paris
date     2022-04-08
rstudio  2022.02.0+443 Prairie Trillium (desktop)
pandoc   NA

I'm trying to access data on Athena from R using ODBC.

I installed unixODBC via brew and the Simba Athena ODBC Driver from the web.

When I run :

con <- DBI::dbConnect(
  odbc::odbc(),
  Driver = "/Library/simba/athenaodbc/lib/libathenaodbc_sb64.dylib",
  S3OutputLocation = "",
  AwsRegion = Sys.getenv("AWS_DEFAULT_REGION"),
  AuthenticationType = "IAM Credentials",
  UID = Sys.getenv("AWS_ACCESS_KEY_ID"),
  PWD = Sys.getenv("AWS_SECRET_ACCESS_KEY")
)

I have this error :

Error: nanodbc/nanodbc.cpp:1021: 00000: [unixODBC][Driver
Manager]Can't open lib
'/Library/simba/athenaodbc/lib/libathenaodbc_sb64.dylib' : file not
found

But this file exists for sure, why unixODBC can't find this file ?

I installed R and RStudio from the web and not via Homebrew, here is the sessionInfo :

version  R version 4.1.3 (2022-03-10)
os       macOS Monterey 12.2
system   aarch64, darwin20
ui       RStudio
language (EN)
collate  en_US.UTF-8
ctype    en_US.UTF-8
tz       Europe/Paris
date     2022-04-08
rstudio  2022.02.0+443 Prairie Trillium (desktop)
pandoc   NA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖兔^ω^ 2025-01-26 22:56:51

我可能在这里偏离了基础,但我总是在实例化调用中使用 Driver= 作为驱动程序的名称,而不是它的库的位置。我确信这是一个 ODBC 问题,所以无论您使用的是 macos 还是 Linux,或者连接到 SQL Server、MariaDB 或其他系统,都没有关系。

例如,在 linux-box 上,在 /etc/odbcinst.ini 中,我有以下部分:

[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.1
UsageCount=1

当我连接到 SQL Server 实例时,我的调用是

con <- dbConnect(odbc::odbc(), Driver="ODBC Driver 17 for SQL Server", ...)

该文件不需要定义在 /etc/ 下,还有其他方法来声明这些驱动程序段。

I might be off-base here, but I've always used Driver= in the instantiation call to be the name of a driver, not the location of a library for it. I am confident this is an ODBC thing, so doesn't matter if you're on macos or linux, or connection to SQL Server or MariaDB or another.

On a linux-box, for instance, in /etc/odbcinst.ini, I have the following section:

[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.1
UsageCount=1

When I connect to a SQL Server instance, my call is

con <- dbConnect(odbc::odbc(), Driver="ODBC Driver 17 for SQL Server", ...)

The file does not need to be defined under /etc/, there are other ways to declare those driver segments.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文