You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/11/29 16:04:58 UTC

zeppelin git commit: ZEPPELIN-1645: JDBC Interpreter does not commit updates

Repository: zeppelin
Updated Branches:
  refs/heads/master cb5c8a414 -> 07fbc6ec8


ZEPPELIN-1645: JDBC Interpreter does not commit updates

### What is this PR for?
Allow users to issue insert/update/upsert statements from Zeppelin notes

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
[ZEPPELIN-1645](https://issues.apache.org/jira/browse/ZEPPELIN-1645)

### How should this be tested?
For Phoenix Interpreter:
Paragraph 1:
%jdbc
UPSERT INTO CX_TEST (ACCT_NBR, HSE_ID) VALUES ('a', 'b')

Paragraph 2:
%jdbc
select count(*) from cx_test

Result: 1

### Questions:
* Does the licenses files need update?
No
* Is there breaking changes for older versions?
No
* Does this needs documentation?
Yes - JDBC README updated

Author: Randy Gelhausen <rg...@gmail.com>

Closes #1617 from randerzander/master and squashes the following commits:

1cf1ce3 [Randy Gelhausen] Added check for connection autocommit status


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/07fbc6ec
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/07fbc6ec
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/07fbc6ec

Branch: refs/heads/master
Commit: 07fbc6ec8c39436e1942ba87a047f08ff7484eaa
Parents: cb5c8a4
Author: Randy Gelhausen <rg...@gmail.com>
Authored: Thu Nov 24 17:57:05 2016 -0500
Committer: Lee moon soo <mo...@apache.org>
Committed: Tue Nov 29 08:04:52 2016 -0800

----------------------------------------------------------------------
 docs/interpreter/jdbc.md                                       | 6 +++++-
 .../main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java    | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/07fbc6ec/docs/interpreter/jdbc.md
----------------------------------------------------------------------
diff --git a/docs/interpreter/jdbc.md b/docs/interpreter/jdbc.md
index e7bd4fe..74ac112 100644
--- a/docs/interpreter/jdbc.md
+++ b/docs/interpreter/jdbc.md
@@ -25,7 +25,11 @@ limitations under the License.
 
 ## Overview
 
-JDBC interpreter lets you create a JDBC connection to any data sources seamlessly. By now, it has been tested with:
+JDBC interpreter lets you create a JDBC connection to any data sources seamlessly.
+
+Inserts, Updates, and Upserts are applied immediately after running each statement.
+
+By now, it has been tested with:
 
 <div class="row" style="margin: 30px auto;">
   <div class="col-md-6">

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/07fbc6ec/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index 7871f01..7e2fb11 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -462,6 +462,8 @@ public class JDBCInterpreter extends Interpreter {
           msg.append(UPDATE_COUNT_HEADER).append(NEWLINE);
           msg.append(updateCount).append(NEWLINE);
         }
+        //In case user ran an insert/update/upsert statement
+        if (connection.getAutoCommit() != true) connection.commit();
       } finally {
         if (resultSet != null) {
           try {