import oracledb
from logging_config import get_logger

logger = get_logger(__name__)

class OracleConnector:

    def __init__(self, config):
        self.config = config
        self.pool = None

    def get_connection(self):
        if not self.pool:
            logger.info("Initializing Oracle connection pool")
            self.pool = oracledb.create_pool(
                user=self.config.db_user,
                password=self.config.db_password,
                dsn=self.config.db_dsn,
                min=1,
                max=5,
                increment=1
            )
        return self.pool.acquire()