Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

vdk-core: parse vdk subsections in config.ini #3305

Description

@DeltaMichael

Overview

To support multiple databases of the same type, we should support subsections in the vdk configuration. The following config should be valid. VDK should parse three separate configs and name them using the subsection names.

[vdk]
oracle_connection_string = localhost:1521/FREE

[vdk.my_oracle]
oracle_connection_string = localhost:1521/FREE

[vdk.another_oracle]
oracle_connection_string = another.oracle.bg:1522/NOP

Suggested Implementation

job_config.py

    def get_vdk_options(self) -> Dict[Dict[str, str]]:
        sections = self._config_ini.sections()
        out = {}
        for section in sections:
            if "vdk" in section:
                out[section] = dict(self._config_ini[section])
         return out

    def get_vdk_options_for_section(self, section: str = None) -> Dict[str, str]:
        sections = self._config_ini.sections()
        if section and self._config_ini.has_section(section):
            return dict(self._config_ini[section])
        elif self._config_ini.has_section("vdk"):
            return dict(self._config_ini["vdk"])
        else:
            return {}

And then in the JobConfigIniPlugin class

    @hookimpl(tryfirst=True)
    def vdk_configure(self, config_builder: ConfigurationBuilder) -> None:
            
            for key, value in job_config.get_vdk_options_for_section("vdk").items():
                config_builder.set_value(key, value)

This should work for the current state of config files without any problem and support sections like vdk.something

Acceptance criteria

  1. Do the above implementation or a better alternative
  2. Add tests

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions