These are chat archives for getredash/redash

29th
Sep 2016
Chandan Kumar
@chandankr_twitter
Sep 29 2016 06:58
Is there any way to pass today's date in queries. For example, I need to query tables with names like table20160928(current date). Is there any way to generate table name from current date like table$current_date.
Chandan Kumar
@chandankr_twitter
Sep 29 2016 07:42
Has anyone faced problems in auto refresh when query params are used
Florian Pieront
@fpieront
Sep 29 2016 08:23
@chandankr_twitter which kind of database are you using? in postgres, i would do this through a stored procedure that I would execute through the redash interface
but this is pretty clunky
it sounds like you could try the Python query runner
Chandan Kumar
@chandankr_twitter
Sep 29 2016 08:25
Google bigquery..I'm looking at BigQuery UDF, returning JSON data via Python or via a script. Thanks.
Florian Pieront
@fpieront
Sep 29 2016 08:31
sadly you then can't adapt the query from Redash UI. So maybe you can compose the query using python on redash and send it to the BQ API. Don't know if the redash python query runner would support any of these libraries though or if that's even what @arikfr had in mind with this feature
Arik Fraimovich
@arikfr
Sep 29 2016 09:34
@HenroRitchie for now you can add it to the counter title...
@biakaveron you need to pass it in the format your db understands (probably something like yyyy-mm-dd). did you define this parameter as datetime and the date we see in the screenshot if the result of the picker?
@rankam the only thing that was done is the python query runner.
@chandankr_twitter auto refresh as in query's refresh schedule or auto refresh in dashboard?
@fpieront it can be done with the python query runner.
Ivan Brotkin
@biakaveron
Sep 29 2016 09:45
@arikfr Yes, I was trying both date & datetime - the same problem.
Chandan Kumar
@chandankr_twitter
Sep 29 2016 09:47
@arikfr i have auto refresh set in both query and dashboard but refreshed stopped after I added parameters {{dt}} in place of 20160929
Arik Fraimovich
@arikfr
Sep 29 2016 09:48
@chandankr_twitter refresh schedule doesn't work with queries that have parameters, because what value should it refresh with? it could use the default value (if one is set), but it's not obvious that this is what the user wants.
Ivan Brotkin
@biakaveron
Sep 29 2016 09:50
https://gyazo.com/c154ff3dc5eefe354449f5fbc6cc0ea0 - as you can see, its already in yyyy-mm-dd, so its not a picker fails
Arik Fraimovich
@arikfr
Sep 29 2016 09:50
@biakaveron you mean in the results? then why do you think it's not working?
Chandan Kumar
@chandankr_twitter
Sep 29 2016 09:52
@arikfr Thanks for clarifying. For dynamic tables based on current date, would you recommend python runner or URL/Script based JSON data? Also, the query.py Python runner example on github doesnt have module import code. Kindly point me to a full example if possible.
Arik Fraimovich
@arikfr
Sep 29 2016 10:11
It depends on your needs and kind of users you allow to your redash instance. The URL/script data sources are simpler and more secure.
Ivan Brotkin
@biakaveron
Sep 29 2016 10:22
@arikfr because date functions not working. https://gyazo.com/1e8f56aef2361729bcc4ec3275396ac4
Florian Pieront
@fpieront
Sep 29 2016 10:28
This message was deleted
Chandan Kumar
@chandankr_twitter
Sep 29 2016 10:29
thanks a ton @arikfr @fpieront
Florian Pieront
@fpieront
Sep 29 2016 10:29
@chandankr_twitter you can import modules when you set up the dats source "Python":
blob
Arik Fraimovich
@arikfr
Sep 29 2016 10:30
@biakaveron did you try date_format('{{dt}}', "%Y-%m-%d")?
Florian Pieront
@fpieront
Sep 29 2016 10:30
i'm going to try out some things with it today, like importing connector libraries to execute queries on other data sources not defined in redash
Arik Fraimovich
@arikfr
Sep 29 2016 10:31
:+1:
Ivan Brotkin
@biakaveron
Sep 29 2016 10:31
@arikfr hhhm, works
Florian Pieront
@fpieront
Sep 29 2016 10:32
how would I use a specific python environment though? can I add a PYTHONPATH variable to /opt/redash/.env?
Arik Fraimovich
@arikfr
Sep 29 2016 10:35
No, it uses the same env as the one that runs Redash.
Ivan Brotkin
@biakaveron
Sep 29 2016 14:03
Question about alerts - what i'm doing wrong? https://gyazo.com/3143f1029a05fb4a1e43889bcd46a8ca
[2016-09-29 14:03:03,758][PID:10221][INFO][metrics] method=POST path=/api/destinations endpoint=destinations status=500 content_type=? content_length=-1 duration=238.04 query_count=5 query_duration=87.61
from logs, but no details
Chandan Kumar
@chandankr_twitter
Sep 29 2016 15:51
@fpieront @arikfr what is the ideal location to place the .py files(modules to be imported)..so can be placed anywhere and full path given in "Modules to import before running the script"? If my functions are in $HOME/files/redashfunctions.py can I give $HOME/files/redashfunctions.py in the "Modules to import" field.
Chandan Kumar
@chandankr_twitter
Sep 29 2016 17:55
What python code do we actually write in the query text box before clicking execute button(for python runner). Is there a full working example anywhere... https://github.com/getredash/redash/blob/master/redash/query_runner/python.py