Skip to content

Commit dd6710b

Browse files
wenermeburmecia
andauthored
Add mysql_fdw for MySQL/Doris support (supabase#584)
* Add mysql_fdw for MySQL/Doris support via text protocol Uses mysql_async crate with text protocol (simple_query) instead of prepared statements, which makes it compatible with Doris and other MySQL-protocol databases that don't support mysql_stmt_result_metadata. Based on mssql_fdw template with MySQL-specific adaptations: - MySQL LIMIT without requiring ORDER BY - String-based date/time parsing for broader compatibility - Support for conn_string and conn_string_id (vault) options * fix: update mysql_fdw website URL to upstream repo path * fix: address CodeRabbit review feedback for mysql_fdw - Add mysql_fdw to native_fdws feature list in Cargo.toml - Preserve SQLSTATE codes for OptionsError/CreateRuntimeError and sanitize mysql_async error messages to avoid leaking credentials - Propagate datetime/date parse errors instead of silently returning NULL - Quote SQL identifiers with backticks to prevent injection and reserved word conflicts * fix: use MySQL-safe cell formatter for WHERE clause values Add MysqlCellFormatter that escapes single quotes and backslashes in string literals, and formats booleans as 0/1 for MySQL compatibility. Use deparse_with_fmt instead of deparse to apply the safe formatter when building WHERE predicates. * fix: inline format args to satisfy clippy uninlined_format_args * fix: address PR review - vault error propagation, identifier quoting in WHERE, and DML support - Replace get_vault_secret().unwrap_or_default() with proper error propagation so missing/failed vault lookups surface as errors instead of empty conn_str - Add custom deparse_qual() that quotes field names with backticks in WHERE clauses, matching the quoting used in SELECT columns and ORDER BY - Implement DML methods (begin_modify, insert, update, delete, end_modify) using the same runtime/connection pattern as begin_scan * feat: add streaming support and test cases * feat(mysql_fdw): enhance schema import and add CRUD tests for MySQL integration * feat(mysql_fdw): enhance user table schema and add additional data validation tests * feat(mysql_fdw): add MySQL foreign data wrapper documentation and support for JSON data type * fix(mysql.md): update author information and change tags from official to community --------- Co-authored-by: Bo Lu <[email protected]>
1 parent 3edd0b1 commit dd6710b

12 files changed

Lines changed: 1444 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 155 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
| [HubSpot](./wasm-wrappers/fdw/hubspot_fdw) | A Wasm FDW for [HubSpot](https://www.hubspot.com/) |||
2323
| [Infura](./wasm-wrappers/fdw/infura_fdw) | A Wasm FDW for [Infura](https://www.infura.io/) blockchain data |||
2424
| [Logflare](./wrappers/src/fdw/logflare_fdw) | A FDW for [Logflare](https://logflare.app/) |||
25+
| [MySQL](./wrappers/src/fdw/mysql_fdw) | A FDW for [MySQL](https://www.mysql.com/) |||
2526
| [Notion](./wasm-wrappers/fdw/notion_fdw) | A Wasm FDW for [Notion](https://www.notion.so/) |||
2627
| [OpenAPI](./wasm-wrappers/fdw/openapi_fdw) | A Wasm FDW for any [OpenAPI](https://www.openapis.org/) 3.0+ REST API |||
2728
| [Orb](./wasm-wrappers/fdw/orb_fdw) | A Wasm FDW for [Orb](https://www.withorb.com/) |||

docs/catalog/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Each FDW documentation includes a detailed "Limitations" section that describes
2727
| Infura |||||||
2828
| Iceberg |||||||
2929
| Logflare |||||||
30+
| MySQL |||||||
3031
| Notion |||||||
3132
| OpenAPI |||||||
3233
| Orb |||||||

0 commit comments

Comments
 (0)