Factory functions¶
Use these to create pre-configured connections before passing them to the class constructors.
SQLAlchemy engine¶
- eurocontrolpy.build_sqlalchemy_oracle_engine(schema='PRU_DEV')[source]¶
Build a SQLAlchemy Engine for Oracle using oracledb (thin mode).
- Reads credentials from environment variables:
{schema}_USR,{schema}_PWD,{schema}_DBNAME
- Parameters:
schema (
str, default'PRU_DEV') – Prefix for the environment variable names.- Return type:
sqlalchemy.engine.Engine
Spark session¶
- eurocontrolpy.build_spark_oracle_session(executor_memory='5g', driver_memory='2g', executor_cores='1', executor_instances='10', shuffle_partitions='100', default_parallelism='100', max_records_per_batch='10000', jar_path='jars/ojdbc8.jar', oracle_fetch_size=1000)[source]¶
Create (or reuse) a SparkSession configured for Oracle JDBC.
- Returns:
The Spark session, JDBC URL, and JDBC connection properties.
- Return type:
tuple[SparkSession,str,dict]- Parameters:
Notes
Requires the environment variables
PRU_DEV_USR(username),PRU_DEV_PWD(password), andPRU_DEV_DBNAME(host:port/service).Download
ojdbc8.jarfrom the Oracle JDBC downloads page and place it at jar_path.