apache / apache/polaris

Support MySQL as Metastore

Open
#2,491 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
2.1k
Forks
522
Avg merge
1d 22h
Merged PRs (30d)
137

Description

### Is your feature request related to a problem? Please describe.

Currently, Polaris only supports PostgreSQL and H2 databases for its relational JDBC persistence layer. Many organizations have existing MySQL infrastructure and expertise, making MySQL support a valuable addition for wider adoption.

### Describe the solution you'd like

Add MySQL support to the relational-jdbc persistence module by:

1. Add MySQL to DatabaseType enum: Extend DatabaseType.java to include MySQL as a supported database type.
2. Create MySQL-specific schema files: Add mysql/ directory under persistence/relational-jdbc/src/main/resources/ with MySQL-compatible schema-v2.sql (v1 is not needed for new database support).
3. Handle MySQL-specific data types in schema:
- Use JSON instead of PostgreSQL's JSONB
- Use TEXT instead of large VARCHAR for column size limitations
4. Update build dependencies: Add MySQL JDBC driver to persistence/relational-jdbc/build.gradle.kts: implementation(libs.mysql.connector.java)
5. Modify QueryGenerator for schema handling: Update getFullyQualifiedTableName() method to handle MySQL's database naming (without schema prefix):
6. Extend existing database type handling in Model classes: The JSON handling logic already exists in ModelEntity.toMap() and ModelPolicyMappingRecord.toMap() - just need to add MySQL case to use plain string instead of PGobject.

### Describe alternatives you've considered

_No response_

### Additional context

MySQL was previously supported through the EclipseLink persistence implementation (see issue https://github.com/apache/polaris/issues/241 and PR https://github.com/apache/polaris/pull/247), but this support is now deprecated since EclipseLink was deprecated in favor of the relational-jdbc implementation. The relational-jdbc module, which is now the recommended production persistence backend, does not currently include MySQL support.

Contributor guide

Open the contributing guide

Research direction

Start with DatabaseType.java, persistence/relational-jdbc/build.gradle.kts, QueryGenerator.getFullyQualifiedTableName(), and the ModelEntity.toMap() and ModelPolicyMappingRecord.toMap() methods. Compare the existing PostgreSQL schema with a new persistence/relational-jdbc/src/main/resources/mysql/schema-v2.sql, then run the relational-jdbc module checks to verify MySQL schema handling, driver setup, table naming, and JSON mapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.