How to configure HAWQ to talk to RStudio and R

How to configure HAWQ to talk to RStudio and R

HAWQ is installed in server which is used by analyst to run all queries.

RStudio has plugin named RPostgreSQL we can use that to talk to HAWQ

Here is command run sheet to do the same

Load the Plugin
>library(RPostgreSQL)

Declare the driver
>drv <- dbDriver("PostgreSQL")

Create the connection
con <- dbConnect(drv,host="10.1.1.1",port="5432",user="username",password="mypasswrd",dbname="mydatabase")

Run the query
rs <- dbSendQuery(con,"select count(*) from mytable")

Fetch the results
> fetch(rs,n=-1)
    count
1 3713399
> 

No comments:

Post a Comment

Please share your views and comments below.

Thank You.