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

add experimental sql_functions to Malloy #1578

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Conversation

christopherswenson
Copy link
Contributor

@christopherswenson christopherswenson commented Jan 10, 2024

TODO:

  • Add experiment sql_functions for this feature
  • Log an error if the user tries to interpolate a field from a join (for now)
  • Log an error if the user tries to interpolate a join itself (for now)

(The join stuff is going to be disabled for now because it doesn't fully work with the compiler's join finder yet. We were thinking first step would be to disable it with an error, second step would be to fix it and re-enable.)

Need to think about, for the future:

  • Whether we want a real syntax for this rather than functions, e.g. sql'MY SQL EXPRESSION'!number
  • Whether a user can specify an aggregate or analytic expression

Copy link
Contributor Author

@christopherswenson christopherswenson left a comment

Choose a reason for hiding this comment

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

Looks good @amarkowitz, thanks for taking this over! Just the two comments I left to address (the one on this review about escaping ${ and the one about the experiment error message).

@christopherswenson
Copy link
Contributor Author

Also looks like some tests are failing... looking.

* add sql_* functions that allow for general sql text to be used
  as expressions which return a specific type.
* these sql_* functions will also interpolate special ${...} lookml
  syntax such as ${TABLE}, ${dimension}, etc
* add experimental Malloy flag 'sql_functions' that must be enabled
  for your Malloy source to use this feature.
@amarkowitz amarkowitz marked this pull request as ready for review January 18, 2024 18:46
@amarkowitz amarkowitz self-requested a review January 18, 2024 21:30
Copy link
Collaborator

@amarkowitz amarkowitz left a comment

Choose a reason for hiding this comment

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

LGTM

@christopherswenson
Copy link
Contributor Author

LGTM, thanks for bringing this up to date and across the finish like @amarkowitz

@amarkowitz amarkowitz merged commit f7cfcb6 into main Jan 18, 2024
4 checks passed
@amarkowitz amarkowitz deleted the crs-lookml-compat branch January 18, 2024 21:38
@amarkowitz amarkowitz changed the title WIP: SQL expression functions add experimental sql_functions to Malloy Jan 18, 2024
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.

2 participants