{"id":26489538,"url":"https://github.com/agstudy/rsqlserver","last_synced_at":"2025-03-20T07:41:46.308Z","repository":{"id":11556361,"uuid":"14042396","full_name":"agstudy/rsqlserver","owner":"agstudy","description":"Sql Server driver  database interface (DBI) driver for R. This is a DBI-compliant Sql Server driver based on the System.Data.SqlClient. ","archived":false,"fork":false,"pushed_at":"2018-02-18T09:53:46.000Z","size":9990,"stargazers_count":82,"open_issues_count":14,"forks_count":30,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-06-16T13:34:01.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agstudy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-01T12:22:01.000Z","updated_at":"2022-09-26T19:55:07.000Z","dependencies_parsed_at":"2022-09-23T00:01:40.465Z","dependency_job_id":null,"html_url":"https://github.com/agstudy/rsqlserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agstudy%2Frsqlserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agstudy%2Frsqlserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agstudy%2Frsqlserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agstudy%2Frsqlserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agstudy","download_url":"https://codeload.github.com/agstudy/rsqlserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244574787,"owners_count":20474818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-20T07:41:45.805Z","updated_at":"2025-03-20T07:41:46.300Z","avatar_url":"https://github.com/agstudy.png","language":"R","readme":"# rsqlserver\n\n[![Build Status](https://travis-ci.org/agstudy/rsqlserver.svg?branch=master)](https://travis-ci.org/agstudy/rsqlserver)\n[![Build status](https://ci.appveyor.com/api/projects/status/g30c0roi0ywenvau/branch/master?svg=true)](https://ci.appveyor.com/project/agstudy/rsqlserver/branch/master)\n\nSQL Server database interface **(DBI)** driver for R.\n\nThis is a DBI-compliant SQL Server driver based on the\n.NET Framework Data Provider for SQL Server; `System.Data.SqlClient`.\n\n## Motivation\n\nThe .NET Framework Data Provider for SQL Server (SqlClient) uses its own protocol\nto communicate with SQL Server. It's lightweight and performs well because it's\noptimized to access a SQL Server directly without adding an OLE DB or Open Database\nConnectivity (ODBC) layer. For this reason, *rsqlserver* [outperforms](https://github.com/agstudy/rsqlserver/wiki/benchmarking) other R packages that rely on ODBC or JDBC layers. If you're using R to interact with SQL Server using large volumes of data and speed matters then *rsqlserver* is the answer!\n\n## Installation\n\n*rsqlserver* is currently available on GitHub for Windows, Linux and macOS users. That said, Linux and macOS users are only able to make use of the package with some workarounds to the usual setup procedure.\n\nThe package's interoperability of R and .NET code is provided by the [rClr](https://github.com/jmp75/rClr) package and unfortunately this package is currently only building on Windows and Mono 3.x (which is several years old) and therefore causing problems for macOS and Linux users.\n\nDue to the cross-platform functionality of Docker containers, it is now possible to install the package in a container on any system.\n\n### Local Installation\n\n*Available for Windows and Linux (with patched rClr)*\n\n**Windows** users can install a pre-compiled binary of *rClr* and **Linux** users will be able to install a patched source of *rClr* by using an out-dated version of Mono.\n\n1. Install *rClr* ([See below](#installing-rclr))\n\n6. Install *rsqlserver* from GitHub\n\n```r\ndevtools::install_github('agstudy/rsqlserver')\n```\n\nFor **macOS** users, Mono 3.12.1 is able to be installed on newer OS X releases however the rClr build is not functioning properly. At the time of writing, the author of rClr is working on refreshing the package to work on newer versions of Mono which may hopefully resolve this issue.\n\n### Docker\n\n*Available for Windows, Linux and macOS*\n\nThe package can be installed on Windows, Linux and macOS via a provided Docker container which also includes an installation of SQL Server 2017. This is the best option for creating a reproducible environment for using the package that is accessible on all platforms and functions the same way regardless of the underlying system.\n\n1. Install Docker for [Mac](https://docs.docker.com/docker-for-mac/install/) or [Windows](https://docs.docker.com/docker-for-windows/install/)\n\n2. Go to Docker \u003e Preferences and increase the supplied memory to at least 4GB\nand \"Apply \u0026 Restart\". This is in order to run the SQL Server container\notherwise it won't even start up.\n\n3. Open a Terminal with the repository as the working directory and follow [the instructions](UsingDocker.md)\n\nThe **bcp** and **sqlcmd** tools are also [now available](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools#macos)\nfor macOS and Docker.\n\nIf you just want to connect to a Docker instance of SQL Server from your local\nMac without *rsqlserver* then follow [these instructions](https://medium.com/@reverentgeek/sql-server-running-on-a-mac-3efafda48861).\n\nTo install the necessary ODBC drivers without *rsqlserver* and connect with the\n*RODBC* package then follow [this wiki](https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Mac-OSX).\n\n### Installing rClr\n\n**Windows**\n\nThe easiest option is to download a pre-compiled binary rather than try and install from source.\n\n1. Install [Microsoft Windows SDK for Windows 7 and .NET Framework 4](https://www.microsoft.com/en-gb/download/details.aspx?id=8279). *rsqlserver* uses the .NET framework SDK to build a small C# project.\nTypically if your machine has the program \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe\", you can skip this step.\n\n2. Install [Visual C++ Redistributable Packages for Visual Studio](https://go.microsoft.com/fwlink/?LinkId=746572).\n\n3. Download [rClr 0.7-4](https://github.com/jmp75/rClr/archive/0.7-4.zip).  (New binary versions will appear in the [GitHub releases](https://github.com/jmp75/rClr/releases). CodePlex is being decommissioned so the rClr 0.7-4 binary is available [here](https://github.com/ruaridhw/rClr/tree/windows-binary) if the source version won't install).\n\n\n```r\ninstall.packages(\"path/to/rClr_0.7-4.zip\", repos = NULL, type = \"source\")\n```\n\n**Linux**\n\nA workaround for installing the package on Linux is to downgrade the installed version of Mono to 3.12.1 using [this script](https://gist.github.com/ruaridhw/b00e75647c8e96c2f44044c970f19c7f) prior to building rClr as the package currently doesn't work on Mono 4.x or later.\n\nOnce you have done this, test that the version of Mono is correct. If you see a version number other than 3.12.1 then the installation was unsuccessful.\n\n```bash\n$ mono -V\n# Mono JIT compiler version 3.12.1 (tarball Fri Mar  6 19:12:47 UTC 2015)\n# Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com\n# \tTLS:           __thread\n# \tSIGSEGV:       altstack\n# \tNotifications: epoll\n# \tArchitecture:  amd64\n# \tDisabled:      none\n# \tMisc:          softdebug\n# \tLLVM:          supported, not enabled.\n# \tGC:            sgen\n```\n\nYou can now install rClr from GitHub:\n\n```r\ndevtools::install_github('jmp75/rClr')\n```\n\nDepending on your distribution this may throw errors with the compilation of the C++ code. If you run into a similar issue as listed [here](https://github.com/jmp75/rClr/issues/27) then try this patched fork:\n\n```r\ndevtools::install_github('serhatcevikel/rClr@03f65ef')\n```\n\n## Features\n\n*rsqlserver* presents many features:\n\n* Easy connection to SQL server using DBI-compliant drivers.\n* Fastest method for loading large delimited text files (\u003e1million rows) and R objects into SQL Server tables or views using `dbBulkCopy` and pulling data back down into R data.frames (See benchmarking below)\n* Use a Trusted Connection with the server. (Windows only).\n* `dbSendQuery` for querying the database; low level functions using pure SQL statements.\n* Full DBI compliance via support of higher level convenience functions such as `dbReadTable`, `dbWriteTable` and `dbRemoveTable`.\n* `dbTransaction`, `dbCommit` and `dbRollback` for **Transaction** management. (TBA)\n* `dbCallProc` for **Stored Procedure** calls. (TBA)\n* Many other DBI extensions such as `dbGetScalar` and `dbGetNoQuery`\n* `dbParameter` to handle Transact-SQL named parameters. This will provide better type checking and improve performance. (TBA)\n\n## Benchmarking\n\nSee the *rsqlserver* wiki page on [benchmarking](https://github.com/agstudy/rsqlserver/wiki/benchmarking) performance versus two other drivers; `RODBC` and `RJDBC.`\n\n## Acknowledgements\n\nI want to thank Jean-Michel Perraud the author of [rClr](http://r2clr.codeplex.com/) package.\n","funding_links":[],"categories":["SQL Server Web Resources"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagstudy%2Frsqlserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagstudy%2Frsqlserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagstudy%2Frsqlserver/lists"}