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

HogQL: Support list placeholders and nullable placeholders #20667

Open
thmsobrmlr opened this issue Mar 1, 2024 · 0 comments
Open

HogQL: Support list placeholders and nullable placeholders #20667

thmsobrmlr opened this issue Mar 1, 2024 · 0 comments
Labels
enhancement New feature or request feature/hogql

Comments

@thmsobrmlr
Copy link
Contributor

Is your feature request related to a problem?

When building HogQL queries backend-side we need to choose wether we want to build up the query from strings that are then parsed into a query or from ast nodes. Often it makes sense to choose ast nodes e.g. when building the select param for an ast.SelectQuery. Now it can happen that other statements also need to use these ast nodes, but are better built as strings e.g. when building the ast would be a complex nested thing and the string would be much more readable.

Describe the solution you'd like

It would be great if these parts could be passed into parse_select and parse_expr as placeholders.

The following things currently don't work:

  1. parse_select('SELECT {columns} FROM events', placeholders={"columns": [ast.Constant(value=1), ast.Constant(value=2)]}) (doesn't support list-type columns)
  2. parse_expr("max(steps) over (PARTITION BY aggregation_target {placeholder}) as max_steps", placeholders={"placeholder": ast.Field(chain=['some_col'])}) (doesn't support the placeholder sibling)
  3. parse_select('SELECT event FROM events WHERE {where}', placeholders={"where": None})(doesn't support nullable placeholder)

Additional context

#19961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature/hogql
Projects
None yet
Development

No branches or pull requests

1 participant