Skip to main content
You can read from and write to other databases using JDBC.
Dependencies:
  • ProphecySparkBasicsPython 0.0.1+
  • ProphecySparkBasicsScala 0.0.1+
Cluster requirements:
  • UC dedicated clusters 14.3+ supported
  • UC standard clusters 14.3+ supported
  • Livy clusters 3.0.1+ supported

Parameters

DB Table

The DB Table option dictates which table to use as the source to read from. You can use anything valid in a FROM clause of a SQL query. For example, instead of a table name, use a subquery in parentheses.
The DB Table option and the query parameter are mutually exclusive, which means that you cannot specify both at the same time.

SQL Query

The SQL Query option specifies which query to use as a subquery in the FROM clause. Spark also assigns an alias to the subquery clause. For example, Spark issues the following query to the JDBC Source:
The following restrictions exist when you use this option:
  1. You cannot use the query and partitionColumn options at the same time.
  2. If you must specify the partitionColumn option, you can specify the subquery using the dbtable option and qualify your partition columns using the subquery alias provided as part of dbtable.

Source

The Source gem reads data from JDBC and allows you to optionally specify the following additional properties. Add these from the Search to pick a property field on the Properties tab.

Source properties

If you get a class not found error while you run your pipeline, add a missing dependency to your cluster. To learn how to add dependencies for specific JDBC jar, see Spark dependencies.

Running stored procedures

Use Execute Pre Query or Execute Post Query to call a stored procedure in the external warehouse directly from a JDBC Source gem. Because the Source gem always returns an output — even when the stored procedure itself produces none — you must still populate Data Source with a placeholder value (for example, a dummy table name or trivial query) to satisfy the gem’s Location configuration.
The JDBC Source gem has no input ports. If a stored procedure needs to run at a specific point in the pipeline rather than at the start, use gem phase to control execution order:
  • Gems upstream of the stored procedure call: Phase 0.
  • The JDBC Source gem running the stored procedure: Phase 1.
  • Gems downstream of the stored procedure call: Phase 2.

Compiled code

To see the compiled code of your project, switch to the Code view in the project header.

Target

The Target gem writes data to JDBC and allows you to optionally specify the following additional properties.

Target properties

Supported write modes

Compiled code

To see the compiled code of your project, switch to the Code view in the project header.