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: Protect against table names with spaces in generated models #5342

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

ericpgreen2
Copy link
Contributor

Closes https://github.com/rilldata/rill-private-issues/issues/404

Additionally, this PR removes the createModelFromSource function in favor of createModelFromTable.

@ericpgreen2 ericpgreen2 self-assigned this Jul 28, 2024
@ericpgreen2 ericpgreen2 changed the title Fix spaces in generated models Fix: Protect against table names with spaces in generated models Jul 28, 2024
@nishantmonu51 nishantmonu51 added the blocker A release blocker issue that should be resolved before a new release label Jul 30, 2024
@@ -75,16 +77,22 @@ export async function createModelFromTable(
const topComments =
"-- Model SQL\n-- Reference documentation: https://docs.rilldata.com/reference/project-files/models";
const connectorLine = `-- @connector: ${connector}`;
const selectStatement = `select * from ${sufficientlyQualifiedTableName}`;
const selectStatement = hasSpaces(sufficientlyQualifiedTableName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not always surround with quotes? Would be convenient when the name is changed later to include spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair, it's subjective but I think it's a little cleaner to omit the quotes if possible

@ericpgreen2 ericpgreen2 merged commit 2dccadc into main Jul 31, 2024
6 checks passed
@ericpgreen2 ericpgreen2 deleted the fix-spaces-in-generated-models branch July 31, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker A release blocker issue that should be resolved before a new release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants