Skip to content

Conversation

@Light2Dark
Copy link
Contributor

📝 Summary

Fixes #6875. Might also tackle #6872.

🔍 Description of Changes

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@vercel
Copy link

vercel bot commented Oct 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Oct 27, 2025 2:21am

formatSelectClause: defaultFormatter.formatSelectClause,
},
default: defaultFormatter,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we can instead use guessDialect and the information from there for quoting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for this, it only works for bigquery as some dialects from codemirror don't have identifierQuotes.

@Light2Dark Light2Dark marked this pull request as ready for review October 27, 2025 01:51
@Light2Dark Light2Dark requested a review from manzt as a code owner October 27, 2025 01:51
Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

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

do we need the early returns for knowndialect? It seems like that could be error prone if we forget to add a case to the switch

}

return `_df = mo.sql(f"SELECT ${columnName} FROM ${tableName} LIMIT 100", engine=${engine})`;
return `_df = mo.sql(f"""${selectClause}""", engine=${engine})`;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe new lines around the query in case it ends with a "

switch (connection.dialect) {
): SQLDialect {
const dialect = connection.dialect;
if (!isKnownDialect(dialect)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it better to just fall though the switch-case so this does not get out of sync?

@Light2Dark
Copy link
Contributor Author

do we need the early returns for knowndialect? It seems like that could be error prone if we forget to add a case to the switch

I can add a logNever and force us to return something. The reason to return early is to ensure the dialect is type-safe, so we must catch that dialect in the switch statements. It will throw error if spelling is off etc.

@mscolnick mscolnick merged commit 21c2a70 into main Oct 27, 2025
26 checks passed
@mscolnick mscolnick deleted the sham/add-dialect-sql-code-gen branch October 27, 2025 13:11
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.

Datasource "Add table to notebook" does not work for MS SQL

3 participants