Connecting RStudio Connect with snowflake

Hi, i am trying to connect a snowflake database with a shiny application on rconnect.
But, i am getting error regarding odbc package.

Hi @akash_gangrade1, welcome to RStudio Community!
To help others have the best opportunity to help you, it's best to provide a reproducible example. The reprex R package can help create such an example.

In this case, it would be helpful to know the code you're using to try and connect to the database along with the specific error message you are receiving.

Hi Blair,

Thanks for the reply, are there any examples where rconnect can connect to snowflake.

I'm sure examples exist, although I don't have any handy. It would be helpful to see what you've already tried and what the specific error is.

1 Like

It seems the snowflake website has some examples, for example at:

Thanks for the reply Andrie,
I am able to connect snowflake via r studio. But when i deploy the application to R connect it throws error regarding odbc package.

ERROR: configuration failed for package ‘odbc’
[Connect] 2020/04/30 06:28:07.308236426 * removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/3.6.2/odbc’.

[Connect] Possible causes:
[Connect] * An R package requires a system-level dependency, such as a library or executable, which is not installed on the Connect server.

1 Like

Thanks for posting the additional detail and error message.

It seems that you have not installed the necessary ODBC drivers on your Connect machine. To fix this situation, you will need to:

  • install the Snowflake ODBC drivers
  • define the necessary ODBC connection strings or DSNs.

RStudio does not provide an ODBC driver for Snowflake, so you will have to obtain the driver files elsewhere.

However, the installation process will most likely be similar to the instructions at https://docs.rstudio.com/pro-drivers/

1 Like

You'll also need to make sure unixODBC is installed: https://github.com/r-dbi/odbc#linux---debian-ubuntu

1 Like

HI,

I tried to install ODBC package on the connect server, but it failed everytime. Do i have to anything different to install it on connect server. It founds the package, unpacks it and throws error.

[Connect] 2020/05/01 17:39:23.875032166 [1] "Command failed (1)\n\nFailed to run system command:\n\n\t'/opt/R/3.6.2/lib/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpBO4k9e/odbc' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/3.6.2' --install-tests --no-docs --no-multiarch --no-demo \n\nThe command failed with output:\n* installing source package ‘odbc’ ...\n** package ‘odbc’ successfully unpacked and MD5 sums checked\n** using staged installation\nmake: Makevars: No such file or directory\nmake: *** No rule to make target 'Makevars'. Stop.\nFound pkg-config cflags and libs!\nPKG_CFLAGS=\nPKG_LIBS=-lodbc\n:1:10: fatal error: sql.h: No such file or directory\ncompilation terminated.\n------------------------- ANTICONF ERROR ---------------------------\nConfiguration failed because odbc was not found. Try installing:\n * deb: unixodbc-dev (Debian, Ubuntu, etc)\n * rpm: unixODBC-devel (Fedora, CentOS, RHEL)\n * csw: unixodbc_dev (Solaris)\n * brew: u
[Connect] nixodbc (Mac OSX)\nTo use a custom odbc set INCLUDE_DIR and LIB_DIR and PKG_LIBS manually via:\nR CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=... PKG_LIBS=...'\n--------------------------------------------------------------------\nERROR: configuration failed for package ‘odbc’\n* removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/3.6.2/odbc’"
[Connect] 2020/05/01 17:39:23.875818428 Error: Command failed (1)
[Connect] 2020/05/01 17:39:23.875827489
[Connect] 2020/05/01 17:39:23.875898292 Failed to run system command:
[Connect] 2020/05/01 17:39:23.875901048
[Connect] 2020/05/01 17:39:23.875913890 '/opt/R/3.6.2/lib/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpBO4k9e/odbc' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/3.6.2' --install-tests --no-docs --no-multiarch --no-demo
[Connect] 2020/05/01 17:39:23.875917656
[Connect] 2020/05/01 17:39:23.875926326 The command failed with output:
[Connect] 2020/05/01 17:39:23.875926976 * installing source package ‘odbc’ ...
[Connect] 2020/05/01 17:39:23.875937936 ** package ‘odbc’ successfully unpacked and MD5 sums checked
[Connect] 2020/05/01 17:39:23.875941558 ** using staged installation
[Connect] 2020/05/01 17:39:23.875949885 make: Makevars: No such file or directory
[Connect] 2020/05/01 17:39:23.875950585 make: *** No rule to make target 'Makevars'. Stop.
[Connect] 2020/05/01 17:39:23.875958785 Found pkg-config cflags and libs!
[Connect] 2020/05/01 17:39:23.875959510 PKG_CFLAGS=
[Connect] 2020/05/01 17:39:23.875978292 PKG_LIBS=-lodbc
[Connect] 2020/05/01 17:39:23.875981848 :1:10: fatal error: sql.h: No such file or directory
[Connect] 2020/05/01 17:39:23.875990550 compilation terminated.
[Connect] 2020/05/01 17:39:23.875991190 ------------------------- ANTICONF ERROR ---------------------------
[Connect] 2020/05/01 17:39:23.876002306 Configuration failed because odbc was not found. Try installing:
[Connect] 2020/05/01 17:39:23.876002992 * deb: unixodbc-dev (Debian, Ubuntu, etc)
[Connect] 2020/05/01 17:39:23.876011006 * rpm: unixODBC-devel (Fedora, CentOS, RHEL)
[Connect] 2020/05/01 17:39:23.876011641 * csw: unixodbc_dev (Solaris)
[Connect] 2020/05/01 17:39:23.876019582 * brew: unixodbc (Mac OSX)
[Connect] 2020/05/01 17:39:23.876020235 To use a custom odbc set INCLUDE_DIR and LIB_DIR and PKG_LIBS manually via:
[Connect] 2020/05/01 17:39:23.876028227 R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=... PKG_LIBS=...'
[Connect] 2020/05/01 17:39:23.876028879 --------------------------------------------------------------------
[Connect] 2020/05/01 17:39:23.876036792 ERROR: configuration failed for package ‘odbc’
[Connect] 2020/05/01 17:39:23.876037532 * removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/3.6.2/odbc’
[Connect] 2020/05/01 17:39:23.876056114
[Connect] 2020/05/01 17:39:23.876057374 Unable to fully restore the R packages associated with this deployment.
[Connect] 2020/05/01 17:39:23.876066674 Please review the preceding messages to determine which package
[Connect] 2020/05/01 17:39:23.876067325 encountered installation difficulty and the cause of the failure.
[Connect] 2020/05/01 17:39:23.886631864 Warning message:
[Connect] 2020/05/01 17:39:23.886712762 In packrat::restore(overwrite.dirty = TRUE, prompt = FALSE, restart = FALSE) :
[Connect] 2020/05/01 17:39:23.886724729 The most recent snapshot was generated using R version 3.6.1
[Connect] 2020/05/01 17:39:23.875149270 Error code: r-missing-system-library

[Connect] An R package cannot be installed because a required system-level dependency is missing.

@Blair09M, @andrie

Hi,

I am the admin of R connect and some different team in the organization manages the server and installed R on the r connect server. Can i install drivers on the server myself or, i have to ask someone from the server team to do it.

You will probably need to ssh into the server and use sudo permissions to complete this installation. I suggest you speak to your server administration team, show them the Connect admin guide and ask for their support.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

You should install the latest release of the RStudio Pro Drivers which -- as of version 1.8.0 -- will enable you to connect to the Snowflake data cloud as a supported connection. Please remember that unixODBC is a prerequisite for using the drivers. For more help, please refer to db.rstudio.com or contact us at support@rstudio.com