I think Treasure Data should...

Add support for variables in Presto web

It would be excellent if I could declare variables somehow. I don't know how this would be implemented, but I use Presto so much for repeated queries that it would be nice to be able to just change variables at the top instead of manually changing values (for instance, dates that are used many times throughout the query) by hand.

10 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Eric Thompson shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Rick Otten commented  · 

        When I run: "td query -q myquery.tdql" I'd like to be able to use parameters in my query script.

        In other words something like:

        myquery.tdql:

        select
        *
        from
        mytable
        where
        somecolumn = {something}
        and
        anothercolumn = {somethingelse}

        then maybe:

        td query -q myquery.tdql --something='foo' --somethingelse='bar'
        or
        td query -q myquery.tdql --parameters="{something: 'foo', somethingelse: 'bar'}"

        I often run a bunch of queries with slightly different parameterized values, this means I either have to have a bunch of nearly identical query files (which is difficult to maintain), or I need to wrap the td query with something that builds temporary query files (which is not ideal either).

        --

        Ditto for the console and saved queries. It would be great if I could put parameters in my saved queries, and then when I need to run a saved query on the console, fill them in.

      Feedback and Knowledge Base