Skip to content

feat(csharp): Add driver manager#4075

Open
davidhcoe wants to merge 6 commits intoapache:mainfrom
davidhcoe:dev/csharp-drivermanager
Open

feat(csharp): Add driver manager#4075
davidhcoe wants to merge 6 commits intoapache:mainfrom
davidhcoe:dev/csharp-drivermanager

Conversation

@davidhcoe
Copy link
Contributor

Implements C# driver manager matching adbc_driver_manager.h spec:

Core APIs:
• LoadDriver() / FindLoadDriver() - Load native/managed drivers
• OpenDatabaseFromProfile() - TOML profile support
• AdbcLoadFlags - Search control (env/user/system paths)

Features:
• Native + managed (.NET) driver loading
• TOML manifests with env_var() expansion
• Uses a custom TOML parser vs Tomlyn because a strong name is required for dependencies
• Cross-platform driver discovery
• Option merging (profile + explicit)
• Co-located manifest detection

Tests: 40+ unit tests + sample BigQuery/Snowflake implementations (attached, not checked in)

BigQueryDriverManagerTests.txt
SnowflakeDriverManagerTests.txt

@davidhcoe
Copy link
Contributor Author

I debated whether to put this in its own assembly or as a subfolder under the shared Adbc project. I decided on a subfolder approach to reduce the number of dependencies required (especially since the AdbcDrivers are still using submodules and any tests there would require an additional submodule to be managed).

@davidhcoe davidhcoe marked this pull request as ready for review March 13, 2026 03:54
@lidavidm
Copy link
Member

Note we noticed various inconsistencies in profiles that we're working on correcting (#4082 / #4085)

@CurtHagenlocher
Copy link
Contributor

To what extent have you tried this with .NET 8.0? I'm discovering that dynamic loading of assemblies is fairly different in that environment.

@davidhcoe
Copy link
Contributor Author

To what extent have you tried this with .NET 8.0? I'm discovering that dynamic loading of assemblies is fairly different in that environment.

It has .NET 8 tests that all pass but I added some more items in the recent push.

@davidhcoe
Copy link
Contributor Author

Note we noticed various inconsistencies in profiles that we're working on correcting (#4082 / #4085)

I added some items to address #4082. For #4085 , based on your table, this implementation currently does:

Feature -> How It Works

  • init_func (entrypoint) priority -> LoadDriver(path, entrypoint) - if provided, uses it directly
  • Load driver from explicit path -> LoadDriver(driverPath)
  • Load driver by name (search) -> FindLoadDriver(driverName, ...) with directory search
  • Load from profile object -> OpenDatabaseFromProfile(profile, ...)
  • Profile from TOML file -> TomlConnectionProfile.FromFile(path)
  • Explicit options override profile -> OpenDatabaseFromProfile(profile, explicitOptions, ...)
  • Managed (.NET) drivers -> LoadManagedDriver(assemblyPath, typeName)
  • Native drivers -> Via CAdbcDriverImporter.Load(...)
  • Co-located manifests (.toml next to .dll) -> Auto-detected in LoadDriver
  • Profile/manifest version fields -> profile_version (new) and version (legacy)
  • Options section naming -> [Options] (new) and [options] (legacy, case-insensitive)

❌ Not Yet Implemented

  • URI parsing -> No parsing of snowflake://..., postgresql://... URIs
  • Profile URI scheme -> No profile:///path/to/file.toml support
  • Driver URI scheme -> No URI that embeds both driver and connection string
  • Profile in options -> No automatic detection of profile key in options dict
  • Multiple profile detection -> No error if profile specified in multiple ways
  • Driver/profile consistency -> No validation that driver arg matches profile's driver
  • URI extraction from driver -> No parsing driver argument as potential URI
  • Non-driver URI detection -> No distinguishing connection URIs from driver URIs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants