These are chat archives for getredash/redash

29th
Feb 2016
Rahul Ghose
@rghose
Feb 29 2016 13:16
Hi, any ideas why "sudo -u redash bin/run ./manage.py send_test_mail" might fail with "AttributeError: '_AppCtxGlobals' object has no attribute 'start_time" ?
@arikfr my version of redash is 0.9.1.b1377, the latest stable one
Arik Fraimovich
@arikfr
Feb 29 2016 13:22
@ninneko no UI or CLI for that at the moment.
@rghose it was fixed in: getredash/redash@ded4761 (part of 0.9.2). You can manually apply this fix to see the real reason you're getting an exception.
Rahul Ghose
@rghose
Feb 29 2016 13:25
right. sound figured that. thanks @arikfr
Rahul Ghose
@rghose
Feb 29 2016 13:48
so looks like, this parameter: REDASH_MAIL_DEFAULT_SENDER is where the e-mails gets sent?
Arik Fraimovich
@arikfr
Feb 29 2016 13:49
the test message - yes
Rahul Ghose
@rghose
Feb 29 2016 13:50
hmm what about messages via triggers?
Arik Fraimovich
@arikfr
Feb 29 2016 13:51
they are sent to the users who subscribed to the alert
Rahul Ghose
@rghose
Feb 29 2016 13:52
so REDASH_MAIL_DEFAULT_SENDER is used as the sender in that case?
Arik Fraimovich
@arikfr
Feb 29 2016 13:52
correct
Rahul Ghose
@rghose
Feb 29 2016 13:53
ok thanks, btw apart from the gravatr in the subscribers list, showing the name/e-mail might be useful.
also how do I retrigger an alert?
Arik Fraimovich
@arikfr
Feb 29 2016 13:53
soon this area going to be changed (see #842). will keep this in mind.
the alert is checked everytime the query runs
Rahul Ghose
@rghose
Feb 29 2016 13:54
I see thanks
also, what does "Rearm seconds" mean? does it mean the query gets fired after "Rearm seconds" ?
Arik Fraimovich
@arikfr
Feb 29 2016 13:55
no, it means if the alert is triggered after "rearm seconds" you will get another notification
Rahul Ghose
@rghose
Feb 29 2016 13:55
okay I see
Rahul Ghose
@rghose
Feb 29 2016 14:05
@arikfr I keep getting : "SMTPException: STARTTLS extension not supported by server" in my celery logs when I try and trigger the alerts via the web-app
test mails work fine though. btw, I am using smtp.gmail.com with starttls disabled.
Arik Fraimovich
@arikfr
Feb 29 2016 14:05
and send_test_mail workers?
Rahul Ghose
@rghose
Feb 29 2016 14:05
yep
Arik Fraimovich
@arikfr
Feb 29 2016 14:05
did you restart your workers after applying the settings?
Rahul Ghose
@rghose
Feb 29 2016 14:05
ah no
I restarted redash though
does that help?
Arik Fraimovich
@arikfr
Feb 29 2016 14:05
the web server?
Rahul Ghose
@rghose
Feb 29 2016 14:06
supervisord
Arik Fraimovich
@arikfr
Feb 29 2016 14:06
this should've done the trik
*trick
make sure celery actually restarted
Rahul Ghose
@rghose
Feb 29 2016 14:06
to be exact: supervisorctl restart redash_server
Arik Fraimovich
@arikfr
Feb 29 2016 14:06
oh
then it wasn't restarted
run restart all
Rahul Ghose
@rghose
Feb 29 2016 14:06
ah then command ?
ok cool
Rahul Ghose
@rghose
Feb 29 2016 14:11
hmm any idea why I get this: Exception: invalid input syntax for integer: "tes"
Task redash.tasks.execute_query[02b012d2-34ce-49a8-8eae-8e5757c7e67a] raised unexpected: Exception('invalid input syntax for integer: "tes"\n',)
Arik Fraimovich
@arikfr
Feb 29 2016 14:11
what's the stack trace?
Rahul Ghose
@rghose
Feb 29 2016 14:12
[2016-02-29 14:08:24,850: ERROR/MainProcess] Task redash.tasks.execute_query[02b012d2-34ce-49a8-8eae-8e5757c7e67a] raised unexpected: Exception('invalid input syntax for integer: "tes"\n',)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(args, **kwargs)
File "/opt/redash/redash.0.9.1.b1377/redash/tasks.py", line 31, in call
return super(BaseTask, self).call(
args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 437, in protected_call
return self.run(*args,
kwargs)
File "/opt/redash/redash.0.9.1.b1377/redash/tasks.py", line 297, in execute_query
raise Exception(error)
Arik Fraimovich
@arikfr
Feb 29 2016 14:12
looks like an error from your database
Rahul Ghose
@rghose
Feb 29 2016 14:14
well it seems to work now...
the E-mail text is like this: "Check alert / check query."
can this be changed ?
Arik Fraimovich
@arikfr
Feb 29 2016 14:19
No.
But if you want to change it to something that will make sense to all Re:dash users, I'll be happy to hear your suggestions and maybe add it to the version.
Rahul Ghose
@rghose
Feb 29 2016 14:22
Probably making this configurable makes sense?
Arik Fraimovich
@arikfr
Feb 29 2016 14:24
legit
we can have a template there
ppawlak
@ppawlak
Feb 29 2016 14:40

Hello, I have issues when trying to setup the "python" data source. I get this error when executing any query :

File "/opt/redash/redash.0.9.1.b1377/redash/tasks.py", line 268, in execute_query
if query_runner.annotate_query():
AttributeError: 'NoneType' object has no attribute 'annotate_query'

Arik Fraimovich
@arikfr
Feb 29 2016 14:41
@ppawlak did you add python query runner to the REDASH_ADDITIONAL_QUERY_RUNNERS setting? (see in Notes here: http://docs.redash.io/en/latest/datasources.html#python)
ppawlak
@ppawlak
Feb 29 2016 14:42
OFC I did, otherwise "python" do not show up in the data source list
Arik Fraimovich
@arikfr
Feb 29 2016 14:42
makes sense. still looks like the celery workers didn't pick up this setting. check if the celery processes were restarted and that you don't have some hanging with old settings
ppawlak
@ppawlak
Feb 29 2016 14:43
that's it
celery workers weren't restarted
thanks a lot !
Arik Fraimovich
@arikfr
Feb 29 2016 14:43
:+1: happy to help :)
@ppawlak what are you planning to do with the python query runner?
ppawlak
@ppawlak
Feb 29 2016 14:46
@arikfr I would like to count a number of events by day (I have a query for this) but cumulative. It may be possible with SQL but I didn't find how, so I wanted to try doing the sum in python
Arik Fraimovich
@arikfr
Feb 29 2016 14:48
what database do you use?
ppawlak
@ppawlak
Feb 29 2016 14:48
I am also giving a try to the whole thing, I am just setting up my redash config
postgresql
Arik Fraimovich
@arikfr
Feb 29 2016 14:49
It should be possible & quite easy w/ Postrges. I can look up an example query you can use for reference.
ppawlak
@ppawlak
Feb 29 2016 14:49
that would be great :)
Arik Fraimovich
@arikfr
Feb 29 2016 14:49
Note that while the Python query runner runs with a sandbox, it's not a very strong one. So it's a bit of a security risk.
ppawlak
@ppawlak
Feb 29 2016 14:49
i noticed that, but I am the only user
my query for counting events is :
SELECT date_trunc('day', created)::date, count(*)
FROM player_player
WHERE created > CURRENT_DATE - 30
GROUP BY 1
ORDER BY 1 DESC
adapted from the demo
Arik Fraimovich
@arikfr
Feb 29 2016 14:51
SELECT created_at::date, sum(count(id)) OVER (ORDER BY created_at)
FROM queries
GROUP BY created_at
That's a query for getting commutative count of queries over time.
the sum-over thing is a WINDOW function. great tool in pg
ppawlak
@ppawlak
Feb 29 2016 14:57
thanks for the query. it works but with 2 little problems:
there are no data on days i have no record : it's empty when using bar diagram . And there are multiple results on days I have several events: i t look weird with the line graph
it's not a big deal I will try to improve it. thanks again
Arik Fraimovich
@arikfr
Feb 29 2016 15:00
yes, probably needs some tweaking. but just wanted to show the usage of a window function to get comulative count.
while Python is great, it might be painful experience to need to wrap every query with Python
Roy Berkowitz
@royzipuff
Feb 29 2016 15:05
@arikfr , is it possible to add more subscribers for a specific alert ?
  • I agree that the mail template should be configurable via cli or a template JSON, it would be nice if i could remove the "[TRIGGERED]" from subjects and some other configurations
Arik Fraimovich
@arikfr
Feb 29 2016 15:55
@royzipuff not sure I understand the question. Every user can subscribe to any alert.
Roy Berkowitz
@royzipuff
Feb 29 2016 15:58
Yep, but it would be nice to have the option to add subscribers. lets say i want to send the alert to everyone@mycompany.com, there is no such user in my reDash, but i would still like to add it to a specific alert as a subscriber
some kind of "advanced options" for the owner of the Alert ..
Arik Fraimovich
@arikfr
Feb 29 2016 18:57
This will be available once #842 will be implemented.