« What data science software tools do you use? | Main | Computerworld's list of R packages for data wrangling »

May 12, 2015

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Great post.

Is it possible to connect to Azure's DocumentDb from R?

Nice article. I liked the technical approach showing the steps to get it running. Please indicate what is your recommendation for the client-side platform. Would Windows 7 64-bit be OK?

@Carlos
Windows 7 64bit should be OK. The clients I tested are: Windows 8.1, 10 "insider preview" and Server 2012 (all 64bit).

@Yolanda
I didn't find a DocumentDB R package or ODBC driver. It does however provide a REST API. So it should be possible to query DocumentDB from R, maybe with the rjson package. Sounds like a great topic for a subsequent post :)

your RSQLServer example didn't work on my azure db, could you provide reproducible example? e.g. using db from: http://sqlblog.com/blogs/jamie_thomson/archive/2012/03/27/adventureworks2012-now-available-to-all-on-sql-azure.aspx

Nice; I didn't know about the public AdventureWorks. I was not able to get RSQLServer to work with it, while it works fine with my DB. Not sure why. If anyone has ideas, let me know. I was however able to get RODBC and RJDBC to work. Here are the corresponding code snippets:


library(RODBC)
conn <- odbcDriverConnect("Driver=SQL Server;Server=mhknbn2kdz.database.windows.net;Database=AdventureWorks2012;Uid=sqlfamily;Pwd=sqlf@m1ly")
sqlQuery(conn, "SELECT TOP 2 * FROM Person.Person")
close(conn)

library(RJDBC)
drv <- JDBC(
driverClass = "com.microsoft.sqlserver.jdbc.SQLServerDriver",
classPath = "C:/JDBC/Microsoft JDBC Driver 4.1 for SQL Server/sqljdbc_4.1/enu/sqljdbc41.jar")
conn <- dbConnect(drv, "jdbc:sqlserver://mhknbn2kdz.database.windows.net", database = "AdventureWorks2012", "sqlfamily", "sqlf@m1ly")
dbGetQuery(conn, "SELECT TOP 2 * FROM Person.Person")
dbDisconnect(conn)

@Yolanda / @Carlos Crossetti

As you say there is an API. I haven't yet played with the DocumentDB API but I've started looking at blob storage with Azure so it might work similarly. I can get a list of blobs but haven't yet cracked the IO. If you'd like to take a look on how you do the authentication etc then it might be a good example. Also, if you need help or want to to help, let me know!
https://github.com/stephlocke/Rtraining/tree/master/R

The comments to this entry are closed.

Search Revolutions Blog




Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr