martinkabe / RSQLS

Package for interactive work with SQL Server
6 stars 1 forks source link
bulk-inserts csharp r rlang sql sql-database sql-server sql-table sql-task sqlserver

RSQLS package

Package for fast interactive work with SQL Server

RSQLS - Package for fast interactive work with SQL Server

Usage is:

Getting Started

Install package directly from github:

library(devtools)
install_github("martinkabe/RSQLS")

Install package from folder content:

Prerequisites

Basic functions - description

push_data

pull_data

send_SQL_task

get_DB_info

get_table_info

Examples

Performance testing

Tested on Intel(R) Core(TM) i7-7500 CPU, 2.70GHz 2.90GHz, 12GB RAM, x64 Operating System Windows, SQL Server 2014 Express.

Rows Columns DBI::dbWriteTable RSQLS::push_data RODBC::sqlSave
1,000,000 6 16.42 15.94 319.10
5,000,000 6 78.69 66.23 1728.53
10,000,000 6 155.50 126.73 NA
50,000,000 6 901.39 711.55 NA
1,000,000 21 27.03 49.81 NA
5,000,000 21 143.25 223.25 NA
10,000,000 21 262.83 415.94 NA

DBI::dbWriteTable and RODBC::sqlSave incorrectly classified scientific notation (1e5, 1.45e2, ...) as varchar type. The same situation with datetime in ISO format was classified as varchar in both cases. RSQLS::push_data correctly classified scientific notation as int or float and datetime in ISO format is correctly datetime data type.

Source code for benchmark is available at link

Approximately the same like DBI::dbFetch and many time faster than RODBC::sqlQuery

Author

License

This project is licensed under the GPL-2 | GPL-3.