Closed RoyalTS closed 1 month ago
Hi:
Thanks for the report. I am, however, unable to reproduce with both:
Here's my environment for the second:
R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.6.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] odbc_1.5.0
loaded via a namespace (and not attached):
[1] bit_4.0.5 compiler_4.3.2 cli_3.6.1 hms_1.1.3 DBI_1.1.3 tools_4.3.2 Rcpp_1.0.11 bit64_4.0.5 vctrs_0.6.4 blob_1.2.4
[11] lifecycle_1.0.4 pkgconfig_2.0.3 rlang_1.1.2
And my connection:
> conn@info
$dbname
[1] "SNOWFLAKE_SAMPLE_DATA"
$dbms.name
[1] "Snowflake"
$db.version
[1] "8.33.1"
<...snip...>
$sourcename
[1] "snowflake_db"
$servername
[1] "Snowflake"
$drivername
[1] "Snowflake"
$odbc.version
[1] "03.52"
$driver.version
[1] "3.1.1"
$odbcdriver.version
[1] "03.80"
$supports.transactions
[1] TRUE
$supports.catalogs
[1] TRUE
$supports.schema
[1] TRUE
$getdata.extensions.any_column
[1] TRUE
$getdata.extensions.any_order
[1] TRUE
Can you try:
odbc
driver? Seems like I am using a newer version. interruptibleExecution
argument set to false
? I have a feeling this will fix your issue. We'll still need to understand if it's a consequence of the driver mismatch or perhaps related to the different ARCH.Bumped the ODBC driver, tried the interruptible=FALSE
argument. Still no dice. It still crashes:
con <- DBI::dbConnect(
odbc::snowflake(),
UID = 'my@email.com',
server = server,
authenticator = 'externalbrowser',
driver = "SnowflakeDriver"
interruptible=FALSE
)
DBI::dbGetQuery(con, 'SELECT lkas')
Hey @RoyalTS
I had a chance to try this out on an M1 Mac as well, and I am still unable to replicate your issue. At this point, I think it might be something specific to your setup. Couple of questions before I give up:
unixODBC
? I know that the Snowflake MacOS/ODBC landing page lists iODBC
as the driver manager of choice, but our [R] package is built specifically for use with unixODBC
.simba.snowflake.ini
configuration file.I am not convinced either of these are relevant since you said everything worked fine prior to upgrading the package, but also running out of ideas.
Do you see the crash when running in a bare [R] terminal ( not RStudio )?
Yup! It terminates with
[1] 44528 abort R
How did you install unixODBC? I know that the Snowflake MacOS/ODBC landing page lists iODBC as the driver manager of choice, but our [R] package is built specifically for use with unixODBC.
via homebrew. Current brew list --versions
:
> brew list --versions
...
unixodbc 2.3.12
...
What's the content of your simba.snowflake.ini configuration file.
# To use this INI file, replace [INSTALLDIR] with the
# directory the tarball was extracted to.
[Driver]
ANSIENCODING=UTF-8
## Note that this default DriverManagerEncoding of UTF-32 is for iODBC. unixODBC uses UTF-16 by default.
## If unixODBC was compiled with -DSQL_WCHART_CONVERT, then UTF-32 is the correct value.
## Execute 'odbc_config --cflags' to determine if you need UTF-32 or UTF-16 on unixODBC
DriverManagerEncoding=UTF-32
DriverLocale=en-US
ErrorMessagesPath=/opt/snowflake/snowflakeodbc/ErrorMessages
LogLevel=0
LogPath=
CURLVerboseMode=false
CABundleFile=/opt/snowflake/snowflakeodbc/lib/universal/cacert.pem
## - Note that the path to your ODBC Driver Manager must be specified in LD_LIBRARY_PATH (LIBPATH for AIX, DYLD_LIBRARY_PATH for Darwin).
## - Note that AIX has a different format for specifying its shared libraries.
## - The driver can load the ODBCInstLib corresponding to the Driver Manager automatically normally you don't need to specify it.
## - In case you get error of "Unable to locate SQLGetPrivateProfileString function" that shows ODBCInstLib is not loaded correctly,
## - uncomment the ODBCInstLib corresponding to the Driver Manager being used and make sure the file name matches what exists on your system.
# Generic ODBCInstLib
# iODBC
# ODBCInstLib=libiodbcinst.so
# SimbaDM / unixODBC
ODBCInstLib=/opt/homebrew/lib/libodbcinst.dylib
# Darwin specific ODBCInstLib
# iODBC
# ODBCInstLib=libiodbcinst.dylib
# AIX specific ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.a(libiodbcinst.so.2)
# SimbaDM
#ODBCInstLib=libodbcinst.a(odbcinst.so)
# unixODBC
#ODBCInstLib=libodbcinst.a(libodbcinst.so.1)
Great, thanks. Can you change DriverManagerEncoding=UTF-32 to UTF-16 and try again
Not it, unfortunately. If it helps:
> odbc_config --cflags
-DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/opt/homebrew/Cellar/unixodbc/2.3.12/include
Those flags look fine. Last question - do you see the same with just [R] + odbc
, without using renv
, and without loading any other extraneous packages.
Otherwise, out of ideas and bit confused since try as I might I can't replicate it - only difference from what I can tell is that this machine I am using to test is running Sequoia. If you feel like getting your hands dirty you could run [R] under lldb
and see if you get a useful stacktrace. But I am also not sure if that will prove very helpful unless we can get a larger sample set of affected machines.
Let me know if you come up with any ideas.
Hmmm, doing this in plain R correctly throws the error but does not crash:
> con <- DBI::dbConnect(
+ odbc::odbc(),
+ UID = 'my@email.com',
+ server = server,
+ authenticator = 'externalbrowser',
+ driver = "SnowflakeDriver"
+ )
> DBI::dbGetQuery(con, 'SELECT does_not_exist')
Error in `DBI::dbGetQuery()`:
! ODBC failed with error 00000 from .
✖ SQL compilation error: error line 1 at position 7
• invalid identifier 'DOES_NOT_EXIST'
• <SQL> 'SELECT does_not_exist'
ℹ From nanodbc/nanodbc.cpp:1722.
Run `rlang::last_trace()` to see where the error occurred.
Hi @RoyalTS
Thanks for following up. OK, to me this is perhaps more of a symptom of a corrupted environment than an issue with this package. Unfortunately I don't know enough about package:renv
to be able to give you some leads on why updating the package version would result in unexpected behavior.
Unless there are objections I'll close this issue. We can re-open if we can more conclusively point to an issue with package:odbc
.
I'm getting somewhat mysterious Rstudio crashes with
odbc
1.5.0
when trying to execute queries that throw errors. Valid queries are fine, as is the previousodbc
version.Install seems to go to plan:
but trying to execute an erroneous query predictably leads to an Rstudio crash
Database
```r > DBI::dbGetInfo(con) $dbname [1] "" $dbms.name [1] "Snowflake" $db.version [1] "8.33.1" $username [1] REDACTED $host [1] "" $port [1] "" $sourcename [1] "" $servername [1] "Snowflake" $drivername [1] "Snowflake" $odbc.version [1] "03.52" $driver.version [1] "2.25.12" $odbcdriver.version [1] "03.80" $supports.transactions [1] TRUE $supports.catalogs [1] TRUE $supports.schema [1] TRUE $getdata.extensions.any_column [1] TRUE $getdata.extensions.any_order [1] TRUE ```Session Info
```r > devtools::session_info() ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.4.1 (2024-06-14) os macOS Sonoma 14.6.1 system aarch64, darwin20 ui RStudio language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz Europe/London date 2024-09-09 rstudio 2024.04.2+764 Chocolate Cosmos (desktop) pandoc NA ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ! package * version date (UTC) lib source P arrow 17.0.0.1 2024-08-21 [?] CRAN (R 4.4.1) P assertthat 0.2.1 2019-03-21 [?] CRAN (R 4.4.0) P bit 4.0.5 2022-11-15 [?] CRAN (R 4.4.0) P bit64 4.0.5 2020-08-30 [?] CRAN (R 4.4.0) P blob 1.2.4 2023-03-17 [?] CRAN (R 4.4.0) P bonsai 0.3.1 2024-07-23 [?] CRAN (R 4.4.0) P cachem 1.1.0 2024-05-16 [?] CRAN (R 4.4.0) P cellranger 1.1.0 2016-07-27 [?] CRAN (R 4.4.0) P class 7.3-22 2023-05-03 [?] CRAN (R 4.4.1) P cli 3.6.3 2024-06-21 [?] CRAN (R 4.4.0) P codetools 0.2-20 2024-03-31 [?] CRAN (R 4.4.1) P colorspace 2.1-1 2024-07-26 [?] CRAN (R 4.4.0) P DALEX 2.4.3 2023-01-15 [?] CRAN (R 4.4.0) P DALEXtra 2.3.0 2023-05-26 [?] CRAN (R 4.4.0) P data.table 1.16.0 2024-08-27 [?] CRAN (R 4.4.1) P DBI 1.2.3 2024-06-02 [?] CRAN (R 4.4.0) P devtools 2.4.5 2022-10-11 [?] CRAN (R 4.4.0) P dials 1.3.0 2024-07-30 [?] CRAN (R 4.4.0) P DiceDesign 1.10 2023-12-07 [?] CRAN (R 4.4.0) P digest 0.6.37 2024-08-19 [?] CRAN (R 4.4.1) P doParallel 1.0.17 2022-02-07 [?] CRAN (R 4.4.0) P dplyr 1.1.4 2023-11-17 [?] CRAN (R 4.4.0) P duckdb 1.0.0-2 2024-07-19 [?] CRAN (R 4.4.0) P ellipsis 0.3.2 2021-04-29 [?] CRAN (R 4.4.0) P fansi 1.0.6 2023-12-08 [?] CRAN (R 4.4.0) P fastmap 1.2.0 2024-05-15 [?] CRAN (R 4.4.0) P forcats 1.0.0 2023-01-29 [?] CRAN (R 4.4.0) P foreach 1.5.2 2022-02-02 [?] CRAN (R 4.4.0) P fs 1.6.4 2024-04-25 [?] CRAN (R 4.4.0) P furrr 0.3.1 2022-08-15 [?] CRAN (R 4.4.0) P future 1.34.0 2024-07-29 [?] CRAN (R 4.4.0) P future.apply 1.11.2 2024-03-28 [?] CRAN (R 4.4.0) P gargle 1.5.2 2023-07-20 [?] CRAN (R 4.4.0) P generics 0.1.3 2022-07-05 [?] CRAN (R 4.4.0) P ggnewscale 0.5.0 2024-07-19 [?] CRAN (R 4.4.0) P ggplot2 3.5.1 2024-04-23 [?] CRAN (R 4.4.0) P globals 0.16.3 2024-03-08 [?] CRAN (R 4.4.0) P glue 1.7.0 2024-01-09 [?] CRAN (R 4.4.0) P googledrive 2.1.1 2023-06-11 [?] CRAN (R 4.4.0) P googlesheets4 1.1.1 2023-06-11 [?] CRAN (R 4.4.0) P gower 1.0.1 2022-12-22 [?] CRAN (R 4.4.0) P GPfit 1.0-8 2019-02-08 [?] CRAN (R 4.4.0) P gtable 0.3.5 2024-04-22 [?] CRAN (R 4.4.0) P hardhat 1.4.0 2024-06-02 [?] CRAN (R 4.4.0) P here 1.0.1 2020-12-13 [?] CRAN (R 4.4.0) P hms 1.1.3 2023-03-21 [?] CRAN (R 4.4.0) P htmltools 0.5.8.1 2024-04-04 [?] CRAN (R 4.4.0) P htmlwidgets 1.6.4 2023-12-06 [?] CRAN (R 4.4.0) P httpuv 1.6.15 2024-03-26 [?] CRAN (R 4.4.0) P ipred 0.9-15 2024-07-18 [?] CRAN (R 4.4.0) P iterators 1.0.14 2022-02-05 [?] CRAN (R 4.4.0) P jsonlite 1.8.8 2023-12-04 [?] CRAN (R 4.4.0) P knitr 1.48 2024-07-07 [?] CRAN (R 4.4.0) P later 1.3.2 2023-12-06 [?] CRAN (R 4.4.0) P lattice 0.22-6 2024-03-20 [?] CRAN (R 4.4.1) P lava 1.8.0 2024-03-05 [?] CRAN (R 4.4.0) P lhs 1.2.0 2024-06-30 [?] CRAN (R 4.4.0) P lifecycle 1.0.4 2023-11-07 [?] CRAN (R 4.4.0) P listenv 0.9.1 2024-01-29 [?] CRAN (R 4.4.0) P lubridate 1.9.3 2023-09-27 [?] CRAN (R 4.4.0) P magrittr 2.0.3 2022-03-30 [?] CRAN (R 4.4.0) P MASS 7.3-60.2 2024-04-26 [?] CRAN (R 4.4.1) P Matrix 1.7-0 2024-04-26 [?] CRAN (R 4.4.1) P memoise 2.0.1 2021-11-26 [?] CRAN (R 4.4.0) P mime 0.12 2021-09-28 [?] CRAN (R 4.4.0) P miniUI 0.1.1.1 2018-05-18 [?] CRAN (R 4.4.0) P munsell 0.5.1 2024-04-01 [?] CRAN (R 4.4.0) P nnet 7.3-19 2023-05-03 [?] CRAN (R 4.4.1) P odbc 1.5.0 2024-06-05 [?] CRAN (R 4.4.1) P parallelly 1.38.0 2024-07-27 [?] CRAN (R 4.4.0) P parsnip 1.2.1 2024-03-22 [?] CRAN (R 4.4.0) P pillar 1.9.0 2023-03-22 [?] CRAN (R 4.4.0) P pkgbuild 1.4.4 2024-03-17 [?] CRAN (R 4.4.0) P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 4.4.0) P pkgload 1.4.0 2024-06-28 [?] CRAN (R 4.4.0) P prodlim 2024.06.25 2024-06-24 [?] CRAN (R 4.4.0) P profvis 0.3.8 2023-05-02 [?] CRAN (R 4.4.0) P promises 1.3.0 2024-04-05 [?] CRAN (R 4.4.0) P purrr 1.0.2 2023-08-10 [?] CRAN (R 4.4.0) P R.cache 0.16.0 2022-07-21 [?] CRAN (R 4.4.0) P R.methodsS3 1.8.2 2022-06-13 [?] CRAN (R 4.4.0) P R.oo 1.26.0 2024-01-24 [?] CRAN (R 4.4.0) P R.utils 2.12.3 2023-11-18 [?] CRAN (R 4.4.0) P R6 2.5.1 2021-08-19 [?] CRAN (R 4.4.0) P rappdirs 0.3.3 2021-01-31 [?] CRAN (R 4.4.0) P Rcpp 1.0.13 2024-07-17 [?] CRAN (R 4.4.0) P readr 2.1.5 2024-01-10 [?] CRAN (R 4.4.0) P recipes 1.1.0 2024-07-04 [?] CRAN (R 4.4.0) P remotes 2.5.0 2024-03-17 [?] CRAN (R 4.4.0) renv 1.0.7 2024-04-11 [1] CRAN (R 4.4.0) P rlang 1.1.4 2024-06-04 [?] CRAN (R 4.4.0) rooar 0.1.11 2024-09-06 [1] Github (deliveroo/rooar@d90dced) P roxygen2 7.3.2 2024-06-28 [?] CRAN (R 4.4.0) P rpart 4.1.23 2023-12-05 [?] CRAN (R 4.4.1) P rprojroot 2.0.4 2023-11-05 [?] CRAN (R 4.4.0) P rsample 1.2.1 2024-03-25 [?] CRAN (R 4.4.0) P rstudioapi 0.16.0 2024-03-24 [?] CRAN (R 4.4.0) P scales 1.3.0 2023-11-28 [?] CRAN (R 4.4.0) P sessioninfo 1.2.2 2021-12-06 [?] CRAN (R 4.4.0) P shapviz 0.9.4 2024-08-20 [?] CRAN (R 4.4.1) P shiny 1.9.1 2024-08-01 [?] CRAN (R 4.4.0) shrtcts 0.1.2 2024-09-06 [1] Github (gadenbuie/shrtcts@41051cf) snowflaker 0.19.0 2024-09-06 [1] Github (deliveroo/snowflaker@da0721d) P stringi 1.8.4 2024-05-06 [?] CRAN (R 4.4.0) P stringr 1.5.1 2023-11-14 [?] CRAN (R 4.4.0) P styler 1.10.3 2024-04-07 [?] CRAN (R 4.4.0) P survival 3.6-4 2024-04-24 [?] CRAN (R 4.4.1) P tibble 3.2.1 2023-03-20 [?] CRAN (R 4.4.0) P tidyr 1.3.1 2024-01-24 [?] CRAN (R 4.4.0) P tidyselect 1.2.1 2024-03-11 [?] CRAN (R 4.4.0) P timechange 0.3.0 2024-01-18 [?] CRAN (R 4.4.0) P timeDate 4032.109 2023-12-14 [?] CRAN (R 4.4.0) P tune 1.2.1 2024-04-18 [?] CRAN (R 4.4.0) P tzdb 0.4.0 2023-05-12 [?] CRAN (R 4.4.0) P urlchecker 1.0.1 2021-11-30 [?] CRAN (R 4.4.0) P usethis 3.0.0 2024-07-29 [?] CRAN (R 4.4.0) P utf8 1.2.4 2023-10-22 [?] CRAN (R 4.4.0) P vctrs 0.6.5 2023-12-01 [?] CRAN (R 4.4.0) P withr 3.0.1 2024-07-31 [?] CRAN (R 4.4.0) P workflows 1.1.4 2024-02-19 [?] CRAN (R 4.4.0) P xfun 0.47 2024-08-17 [?] CRAN (R 4.4.0) P xgboost 1.7.8.1 2024-07-24 [?] CRAN (R 4.4.0) P xml2 1.3.6 2023-12-04 [?] CRAN (R 4.4.0) P xtable 1.8-4 2019-04-21 [?] CRAN (R 4.4.0) P yaml 2.3.10 2024-07-26 [?] CRAN (R 4.4.0) P yardstick 1.3.1 2024-03-21 [?] CRAN (R 4.4.0) [1] /Users/REDACTED/repos/ne-pricing-macro/renv/library/macos/R-4.4/aarch64-apple-darwin20 [2] /Users/REDACTED/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.4/aarch64-apple-darwin20/f7156815 P ── Loaded and on-disk path mismatch. ```