OracleConnector

Oracle JDBC source connector.

class scamander.sources.oracle_connector.OracleConnector(config: Config, *args, **kwargs)

Basisklassen: Source

Source connector that reads an Oracle table or query into a Spark DataFrame via JDBC.

The JDBC URL is built from host, port, and either service_name (jdbc:oracle:thin:@//host:port/service_name) or sid (jdbc:oracle:thin:@host:port:SID). service_name takes precedence when both are provided.

Parameters:
  • config (Config) – Validated configuration object containing Oracle connection details under config.source.options.

  • spark (SparkSession) – An active Spark session used to execute the JDBC read.

Veroorzaakt:
  • ValueError – If config.source.options is not an OracleSourceOptions instance.

  • ValueError – If neither service_name nor sid is provided.

  • ValueError – If neither options.table nor options.query is provided.

connect() → DataFrame

Establishes a JDBC connection to Oracle and returns data as a Spark DataFrame.

When options.query is set it is used as the data source (wrapped in a subquery for JDBC compatibility); otherwise options.table is used directly.

Returns:

A Spark DataFrame backed by the Oracle source.

Return type:

DataFrame