Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,6 @@ public class JDBCInterpreter extends Interpreter {

private final Map<String, ArrayList<Connection>> propertyKeyUnusedConnectionListMap;
private final Map<String, Connection> paragraphIdConnectionMap;

static {
Interpreter.register(
"sql",
"jdbc",
JDBCInterpreter.class.getName(),
new InterpreterPropertyBuilder()
.add(DEFAULT_URL, "jdbc:postgresql://localhost:5432/", "The URL for JDBC.")
.add(DEFAULT_USER, "gpadmin", "The JDBC user name")
.add(DEFAULT_PASSWORD, "",
"The JDBC user password")
.add(DEFAULT_DRIVER, "org.postgresql.Driver", "JDBC Driver Name")
.add(COMMON_MAX_LINE, MAX_LINE_DEFAULT,
"Max number of SQL result to display.").build());
}

public JDBCInterpreter(Properties property) {
super(property);
Expand Down
39 changes: 39 additions & 0 deletions jdbc/src/main/resources/interpreter-setting.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{
"group": "jdbc",
"name": "sql",
"className": "org.apache.zeppelin.jdbc.JDBCInterpreter",
"properties": {
"default.url": {
"envName": null,
"propertyName": "default.url",
"defaultValue": "jdbc:postgresql://localhost:5432/",
"description": "The URL for JDBC."
},
"default.user": {
"envName": null,
"propertyName": "default.user",
"defaultValue": "gpadmin",
"description": "The JDBC user name"
},
"default.password": {
"envName": null,
"propertyName": "default.password",
"defaultValue": "",
"description": "The JDBC user password"
},
"default.driver": {
"envName": null,
"propertyName": "default.driver",
"defaultValue": "org.postgresql.Driver",
"description": "JDBC Driver Name"
},
"common.max_count": {
"envName": null,
"propertyName": "common.max_count",
"defaultValue": "1000",
"description": "Max number of SQL result to display."
}
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ private static String getJdbcConnection() throws IOException {
}
return jdbcConnection;
}

public static Properties getJDBCTestProperties() {
Properties p = new Properties();
p.setProperty("default.driver", "org.postgresql.Driver");
p.setProperty("default.url", "jdbc:postgresql://localhost:5432/");
p.setProperty("default.user", "gpadmin");
p.setProperty("default.password", "");
p.setProperty("common.max_count", "1000");

return p;
}

@Before
public void setUp() throws Exception {
Expand Down Expand Up @@ -116,7 +127,7 @@ public void testForMapPrefix() throws SQLException, IOException {

@Test
public void testDefaultProperties() throws SQLException {
JDBCInterpreter jdbcInterpreter = new JDBCInterpreter(new Properties());
JDBCInterpreter jdbcInterpreter = new JDBCInterpreter(getJDBCTestProperties());

assertEquals("org.postgresql.Driver", jdbcInterpreter.getProperty(DEFAULT_DRIVER));
assertEquals("jdbc:postgresql://localhost:5432/", jdbcInterpreter.getProperty(DEFAULT_URL));
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@
<exclude>conf/zeppelin-env.sh</exclude>
<exclude>spark-*-bin*/**</exclude>
<exclude>.spark-dist/**</exclude>
<exclude>**/interpreter-setting.json</exclude>

<!-- bundled from bootstrap -->
<exclude>docs/assets/themes/zeppelin/bootstrap/**</exclude>
Expand Down