Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MySQLConnection::get_schema for uppercase TableReference #166

Conversation

Jeadie
Copy link

@Jeadie Jeadie commented Nov 12, 2024

For MySQL servers with table names (or schema, catalogs), get_schema does not handle uppercases correctly.

  • table_reference.to_quoted_string() uses the DefaultDialect which has a different identifier_quote_style than MySqlDialect.

impl MySQLConnection {
fn column_meta_query_for(tbl: &TableReference) -> String {
let q = MySqlDialect {}
.identifier_quote_style("") // parameter unimportant for `MySqlDialect`.
Copy link
Collaborator

@sgrebnov sgrebnov Nov 12, 2024

Choose a reason for hiding this comment

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

  1. Might be better to move to utility function plus hardcode MySqlDialect quote character w/o using MySqlDialect

https://github.com/apache/datafusion/blob/cd69e373320a1682dfa7c32d14d5294add8b5fee/datafusion/sql/src/unparser/dialect.rs#L276C1-L279C6

  1. Can identifiers be already quoted?

@phillipleblanc phillipleblanc merged commit 2ef1f89 into datafusion-contrib:spiceai Nov 14, 2024
3 checks passed
zeroxaa pushed a commit to ReByteAI/datafusion-table-providers that referenced this pull request Nov 22, 2024
…afusion-contrib#166)

* fix MySQLConnection::get_schema for uppercase TableReference

* Update mysqlconn.rs

* PR reviews

* fix clppy

* flatten

* Update mysqlconn.rs

---------

Co-authored-by: Phillip LeBlanc <[email protected]>
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.

4 participants