[ 
https://issues.apache.org/jira/browse/LIVY-882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gyorgy Gal updated LIVY-882:
----------------------------
    Fix Version/s: 0.10.0
                       (was: 0.9.0)

This issue has been moved to the 0.10.0 release as part of a bulk update. If 
you feel this is moved out inappropriately, feel free to provide justification 
and reset the Fix Version to 0.9.0.

> Livy doesnot have an endpoint that would support execution of multiple SQL 
> files in a single Interactive Session.
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: LIVY-882
>                 URL: https://issues.apache.org/jira/browse/LIVY-882
>             Project: Livy
>          Issue Type: New Feature
>          Components: API
>    Affects Versions: 0.7.0
>            Reporter: Sandeep Kumar Mamidi
>            Priority: Major
>             Fix For: 0.10.0
>
>
> *Problem Description :-* 
> Our requirement is that: in a single Livy Interactive Session, User wants to 
> execute "x" number of SQL Files.User wants to explicitly pass these SQL files 
> to the interactive session and perform execution. These SQL Files consists of 
> contain multiple DDL, DML statements. 
> Below is how the User wants to run multiple SQLs using an interactive 
> session:- 
> 1) Open a Interactive Session with a predefined session name.
> {noformat}
>  /usr/bin/curl --silent --negotiate -u:$USER --max-time 30 
> ${LIVY_SERVER}${uri} -X POST -H "X-Requested-By: $USER" -H 'Content-Type: 
> application/json' -d "${json_data}" {noformat}
> 2) Using the session name opened in the above step, User wants to perform 
> execution of multiple SQL Files. 
> {noformat}
>  /usr/bin/curl -v --negotiate -u:$USER --max-time 30 
> "${LIVY_SERVER}${uri}/upload-statements?outputPath=$output_file" -H 
> "X-Requested-By: $USER" -X POST -F file=@${code_file} -H 'Content-Type: 
> multipart/form-data'{noformat}
> In the above curl command, code_file is the SQL File which the User has 
> passed for execution. 
> *Suggested Solution :-* 
> The following code would support the new endpoint (upload-statements) for 
> Livy Rest API:- 
> Below code needs to be added in 
> "server/src/main/scala/org/apache/livy/server/interactive/InteractiveSessionServlet.scala"
>  
> {noformat}
>  post("/:id/upload-statements") {
>     withModifyAccessSession { session =>
>       fileParams.get("file") match {
>         case Some(file) =>
>           val fileContent = new String(file.get)          val outputPath = 
> params.get("outputPath")
>           val req = new ExecuteRequest(fileContent, None, outputPath)
>           val statement = session.executeStatement(req)
>           Created(statement,
>             headers = Map(
>               "Location" -> url(getStatement,
>                 "id" -> session.id.toString,
>                 "statementId" -> statement.id.toString)))
>         case None =>
>           log("Could not get the content of the file")
> }{noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to