These are chat archives for getredash/redash

5th
Nov 2015
ShyamK
@shyamgopal
Nov 05 2015 04:18
@dhuynh :thumbsup:
gissehel
@gissehel
Nov 05 2015 18:00
Hello, is there a way to create query on several databases ? Or to query in redash other query results (in order to consolidate queries executed on sevral databases) ?
I suppose there is currently no way to do that currently, but I prefer asking.
Arik Fraimovich
@arikfr
Nov 05 2015 18:09
@gissehel actually there is :-) I'll elaborate soon when I get to my laptop.
Arik Fraimovich
@arikfr
Nov 05 2015 18:42

re:dash has support for a Python datasource, which basically executes Python code as a query. It's not enabled by default, because it's a security risk (the code runs in a sandbox, but depends on your settings, user might escape from this sandbox). If you deploy re:dash in an internal network/behind VPN, and trust your users, you can use it.

In which case you can do a Python "query" to join two queries, where each can be from a different data source:
https://gist.github.com/arikfr/be7c2888520c44cf4f0f

@gissehel if this is relevant, let me know and I'll explain how to enable it.

gissehel
@gissehel
Nov 05 2015 19:44
Ok
Python queries might be able to do the trick.
I was thinking of a "nicer" way to use query results.
Arik Fraimovich
@arikfr
Nov 05 2015 19:46
@gissehel yeah, eventually it will be nice to add a UI that will allow merging query results.
gissehel
@gissehel
Nov 05 2015 19:48
What I was thinking wasn't a new UI but rather a new query runner
That would extract existing query results, put them in a sqlite in-memory database, execute a query over the result and thrash the database.
Technically, this should work
It's a bit of an aberation, but should work :)
Arik Fraimovich
@arikfr
Nov 05 2015 19:50
@gissehel that's actually interesting. there are 2 projects that do something similar as a cli tool (allowing you to run SQL over CSV file by loading it into a sqlite db).
@gissehel need to explore it and check performance, but might a very cool solution.
gissehel
@gissehel
Nov 05 2015 19:51
I was thinking trying to implement it now I already done a query runner.
But I'll first try to rewrite entirly the database init code
by doing it behing manage.py
Arik Fraimovich
@arikfr
Nov 05 2015 19:53
@gissehel I've used flask-script to build it, if you look for documentation. although you can just look at existing code as reference
gissehel
@gissehel
Nov 05 2015 19:54
Yes, started to write some code
it's 70% finished
about that
Arik Fraimovich
@arikfr
Nov 05 2015 19:55
:+1:
gissehel
@gissehel
Nov 05 2015 19:55
I choose to put an "init" command in the redash/cli/database.py class, that redirect to a class in a new redash/database_init.py.
What do you thing about that (in term of code organisation) ?
Arik Fraimovich
@arikfr
Nov 05 2015 20:00
maybe just have redash/cli/db_init.py with the cli & logic code in there?
gissehel
@gissehel
Nov 05 2015 20:02
Ok. "cli/db_init.py" that would export a "db_init" command ?
Arik Fraimovich
@arikfr
Nov 05 2015 20:02
yes
gissehel
@gissehel
Nov 05 2015 20:02
Ok, I'll do it that way.
Arik Fraimovich
@arikfr
Nov 05 2015 20:14
thanks