Skip to content

feat(connection-import): import connections from MySQL Workbench - #1355

Merged
debba merged 4 commits into
TabularisDB:mainfrom
arxhr007:feat/1310-import-mysql-workbench
Nov 2, 2026
Merged

debba merged 4 commits into
TabularisDB:mainfrom
arxhr007:feat/1310-import-mysql-workbench

Conversation

@arxhr007

@arxhr007 arxhr007 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1310.

What

Adds MySQL Workbench to Import connections > Import from App. The importer reads connections.xml from Workbench's data folder (~/.mysql/workbench on Linux, ~/Library/Application Support/MySQL/Workbench on macOS, %APPDATA%\MySQL\Workbench on Windows). If it is not found there, a folder or the connections.xml file can be chosen by hand.

Each Standard TCP/IP and Standard TCP/IP over SSH connection becomes a MySQL connection with:

  • name, host, port, user and default schema
  • the SSL level (useSSL 1 to 4 maps to preferred, required, verify_ca, verify_identity) and the CA, certificate and key paths
  • the SSH host, port, user and key file (the key file selects key authentication, otherwise password)

Local socket connections and other Workbench drivers are skipped with a log::warn!, so one of them does not fail the whole import. Passwords are not imported (they live in the OS keychain or Workbench's vault), as described in the issue.

The importer is a new mysql_workbench.rs next to the others, registered in all_importers(). It does not depend on Tauri, and no frontend change was needed.

Tests

Fixture-based tests in importer_tests.rs cover a direct connection with SSL, an SSH connection, a skipped socket connection, a manual folder and file path, and the missing file, invalid XML and empty file errors. Two unit tests cover the host:port split and the useSSL levels.

Verification

  • cargo check --no-default-features --bin tabularis passes.
  • I could not run cargo test on the full crate on my machine because the tauri dev-dependency needs GTK and WebKit libraries. I ran the new tests (5) in a small separate crate that compiles mysql_workbench.rs with the real types.rs and importer trait, and they pass. The importer_tests.rs additions have not run inside this repo's own test target, so CI will be their first run there.
  • The connections.xml structure (driver ids, parameterValues keys, sshHost as host:port) is taken from two third-party fixtures of Workbench's format; I do not have a real export from a Workbench install. My fixture follows the same shape with fake hosts. If someone with Workbench can confirm that a real file imports, that would be a useful check.

Workbench connection groups are not imported, because I could not confirm how they are stored.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Add MySQL Workbench to Import connections > Import from App. The importer
reads connections.xml from Workbench's data folder (found automatically on
Linux, macOS and Windows, with a manual folder or file path as fallback) and
maps each TCP/IP and TCP/IP over SSH connection to a MySQL connection: name,
host, port, user, default schema, the SSL level and certificate paths, and the
SSH host, port, user and key file.

Local socket connections and other Workbench drivers are skipped with a log
warning so they do not fail the whole import. Passwords live in the OS
keychain or Workbench's vault and are not imported.

Closes #1310
database: get("schema").unwrap_or("").to_string(),
username: get("userName").unwrap_or("").to_string(),
driver_label: "MySQL".to_string(),
ssh: if over_ssh { parse_ssh(&params) } else { None },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: SSH connection silently downgraded to a direct connection

For a native_sshtun connection, parse_ssh returns None when sshHost is missing or empty, so the connection is imported with ssh: None. Its host is typically a private address only reachable through the tunnel, so the imported connection is created without a tunnel and will fail to connect, with no indication why. Either skip the connection with a log::warn! (like the unsupported drivers) or surface a warning when over_ssh is true but no SSH config could be built.

"password"
}
.to_string(),
private_key_path: key_file.map(resolve_key_path),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Windows key paths are mangled by resolve_key_path

resolve_key_path only treats paths starting with / or ~/ as absolute. This importer explicitly supports Windows (%APPDATA%\MySQL\Workbench), where sshKeyFile is typically an absolute path like C:\Users\me\.ssh\id_rsa. It would be rewritten to ~/.ssh/C:\Users\me\.ssh\id_rsa, which does not exist, so key auth breaks for Windows Workbench users. Workbench stores the full path chosen in its UI, so it is not a bare filename. Keep absolute paths (including drive-letter and UNC paths) as-is, e.g. by checking Path::new(key).is_absolute() before falling back to resolve_key_path.

@kilo-code-bot

kilo-code-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The latest commit only moves the unit tests of mysql_workbench.rs into mysql_workbench/tests.rs (mod tests;). The test contents are unchanged and there are no functional changes.

Files Reviewed (2 files)
  • src-tauri/src/connection_import/mysql_workbench.rs
  • src-tauri/src/connection_import/mysql_workbench/tests.rs
Previous Review Summaries (2 snapshots, latest commit 1e39902)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 1e39902)

Status: No Issues Found | Recommendation: Merge

Both previous findings are resolved in the latest commits:

  • SSH-tunnel connections without an sshHost are now skipped with a warning instead of being imported as direct connections (covered by a new test fixture).
  • Windows drive-letter and UNC key paths are now preserved by key_path (covered by keeps_absolute_key_paths).
Files Reviewed (2 files)
  • src-tauri/src/connection_import/mysql_workbench.rs
  • src-tauri/src/connection_import/importer_tests.rs

Previous review (commit 00bc9dc)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src-tauri/src/connection_import/mysql_workbench.rs 181 An SSH-tunnel connection with a missing/empty sshHost is imported with ssh: None, silently becoming a direct connection to a host that is usually only reachable via the tunnel. Skip it with a warning or surface a warning.
src-tauri/src/connection_import/mysql_workbench.rs 207 resolve_key_path does not recognise Windows absolute paths (C:\..., UNC), so Workbench-on-Windows key files become ~/.ssh/C:\... and key auth breaks. Keep absolute paths as-is.
Files Reviewed (3 files)
  • src-tauri/src/connection_import/mysql_workbench.rs - 2 issues
  • src-tauri/src/connection_import/mod.rs
  • src-tauri/src/connection_import/importer_tests.rs

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 856 · Cached: 161.1K

Review guidance: REVIEW.md from base branch main

Skip an SSH tunnel connection that has no SSH host instead of importing it
as a direct connection to a host that is usually only reachable through the
tunnel. Keep absolute SSH key paths as they are, including Windows
drive-letter and UNC paths, which resolve_key_path would take for a bare
file name and rewrite under ~/.ssh.
debba
debba previously approved these changes Nov 2, 2026

@debba debba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @arxhr007 for adding both the discovered and manually selected Workbench paths, and for skipping a tunnel entry with a missing SSH host instead of turning it into a direct connection. I appreciate the clear note about the fixture's provenance and what you couldn't test.

I checked the parser, SSL/SSH mapping and registration, and ran the connection-import tests on this branch. One small follow-up: please move the inline mysql_workbench.rs test module into a sibling test file, following rule 4 in .rules/rust.md.

That nit doesn't block the change for me. I'll keep the merge pending the app checks; those will use fixtures and won't establish compatibility with every real Workbench export.

This is your first PR in this repo. If you'd like to join us on Discord, we'd be happy to have you: https://discord.com/invite/K2hmhfHRSt

…ing file

Follows rule 4 in .rules/rust.md. The three tests are unchanged apart from the indentation.

@debba debba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @arxhr007 for moving the Workbench helper tests into their own file while keeping all three tests and their assertions intact. The direct and SSH fixture cases still cover SSL mapping, missing SSH hosts and the paths that should be skipped.

I ran all 52 connection-import tests on your head. I also merged current main to resolve the overlap with the new HeidiSQL importer, preserving both registrations and both sets of tests; all 67 connection-import tests pass on that integrated head. I have not found any remaining issues. Approved.

The fixture-based checks do not establish compatibility with every real Workbench export. I will merge once the checks on the updated head finish.

@debba
debba merged commit 3ac4c4b into TabularisDB:main Nov 2, 2026
2 checks passed
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.

[Feat]: Import connections from MySQL Workbench

2 participants