'How can I call a .sql file from R?
I have a rather large query that I am trying to run within my R script. Rather than create a variable within my script ( that raises the error: variable names are limited to 10000 bytes), I would like to call it as an OS file. Or will implement another solution, if there is a better one out there. Can someone please share the syntax to call a .sql file as a dbGetQuery() function in R?
Solution 1:[1]
The answer to this issue was to reduce the scope of rows returned in a single dataframe, as R has a limit on how large it can be.
When I queried the imported rows with a for loop defined by MM and YYYY on one of my date columns, I got the rows in small chunks, which got around this limitation, and off course I had to dump R's used RAM with every import loop. I was able to do everything in R with dbExecute() and dbGetQuery(). I used BCP to populate a staging table with all varchar(255) columns and then used dbGetQuery() to call a SQL insert statement that formated date and bit columns.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | FarmBoy |