r2dbc / r2dbc-spi

Service Provider Interface for R2DBC Implementations
Apache License 2.0
421 stars 57 forks source link

Expose database/schema metadata through Connection #203

Open j30ng opened 3 years ago

j30ng commented 3 years ago

Feature Request

Expose detailed metadata about the database through Connection interface, similar to how a JDBC Connection exposes DatabaseMetaData.

Is your feature request related to a problem? Please describe

Not really. This feature is an enhancement. Metadata about the underlying database should make dealing with DDL queries easier. A DatabaseMetaData in JDBC for example contains information such as names of all tables in the database, list of types supported by the DBMS, etc.

Not having this additional API wouldn't be much of a problem when you have to deal with only one type of DBMS, but it could be helpful when you're dealing with more than one. Especially when you're writing a library (e.g. an ORM) that uses R2DBC drivers to deal with arbitrary DBMS's. As in this case for example: https://github.com/JetBrains/Exposed/issues/456#issuecomment-678535178

Describe the solution you'd like

R2DBC Connection interface should include a method which exposes detailed metadata about the database obtained from the Connection.

Describe alternatives you've considered

We could decide not to add complexities to the SPI, keeping it minimal. Applications/Libraries can still generate DDL, only with some difficulties.

mp911de commented 3 years ago

R2DBC aims to expose only driver- and server-specific metadata (driver name, database version). Adding schema capabilities basically would add only a dialect abstraction on top of drivers and we wanted to avoid that. The actual question is: How much is such a feature required to justify demand vs. effort. Having 50% of all SPI users that want such a feature is a different story from having 1% of all users asking for the feature.

steel119 commented 2 years ago

+1