Giter Site home page Giter Site logo

qds-sdk-r's Introduction

qds-sdk-R

R wrapper code for launching Hive, Spark, Presto queries using qds-sdk-py.

Requires

  1. QDS Python SDK. To install it, you can either:

    • Install it from PyPI - pip install qds-sdk.

    • Download the package from GitHub and then

      cd /path/to/qds-sdk-py/
      sudo python setup.py install
      
  2. rPython. In R,

    install.packages("rPython")
    

Installation:

In R

install.packages("devtools")
devtools::install_github("qubole/qds-sdk-R")

Usage:

In Shell

$ export QDS_API_TOKEN = xxyyzz

In R

library(qds)
results<-qds::quboleHiveCommand(query="show tables")

Or

library(qds)

hive<-HiveCommand$new() 
Or 
hive<-HiveCommand$new(<apitoken>) 
Or
hive<-HiveCommand$new(<apitoken>,<pollinterval>)

For Spark:
spark<-SparkCommand$new()
sparkCmdId<-spark$submit(sql="select * from default_qubole_memetracker limit 10")

Asynchronous

commandId<-hive$submit(query = "show tables")
result<-hive$getresult(commandId)

Cancel

hive$cancel(<commandId>)

Synchronous

result<-hive$run(query = "show tables")

For results

hive$getresult(<commandId>)

For logs

hive$getlog(<commandId>)

To display command object

hive$check(<commandId>)

Optional:

To change the default QDS environment variables,

$ export QDS_API_TOKEN = xxyyzz
$ export QDS_API_URL = https://api.qubole.com/api/
$ export QDS_API_VERSION = v1.2

Notes:

The default api_url is https://api.qubole.com/api/.

The default api_version is v1.2.

Additionally you can also use sampling in Hive. For further details read this page.

qds-sdk-r's People

Contributors

karandeep-johar avatar rohitagarwal003 avatar shridharama avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

qds-sdk-r's Issues

Can't parse result of check(<commandId>)

I would like to check a command's status programmatically. However the result of

presto$check(commandId)

is printed to console and I couldn't assign it to a variable. I've tried capture.output and that didn't work. How would you suggest going about this? Thank you.

Getting result of a query in a data frame in R

Hi,

I am trying to get the result of a hive command in a data frame in R using the qds package.

results<-qds::quboleHiveCommand(query="show tables" ,api_token='xxx')

But instead of getting the result of my query in 'results' , i just get the output of my query in the R console.
Is there any way to get the result set of the query in a data frame??

Thanks
Japneesh Singh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.