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

Feature: Queries CLI - Fork query with visualizations #1253

Closed
wants to merge 1 commit into from
Closed

Feature: Queries CLI - Fork query with visualizations #1253

wants to merge 1 commit into from

Conversation

WesleyBatista
Copy link
Contributor

@WesleyBatista WesleyBatista commented Aug 23, 2016

Nowadays, our 'fork' button do not copy the query's visualizations.



While it would be good to have this behavior 'fixed' on the button, I noticed that we do not have a CLI for queries. Also, I thought that would be easier to add a command line interface than make changes on the API, UI...



Example:



1. Create a query;

2. Create visualizations to the query created;

3. Execute python manage.py queries fork 1 where 1 is the query id;



captura de tela 2016-08-23 as 17 42 45





> You need to navigate to the new query page created and run the query to get 'query_results'



captura de tela 2016-08-23 as 17 36 00



Run python manage.py queries fork --help to get additional help for optional parameters.

@arikfr
Copy link
Member

arikfr commented Aug 29, 2016

Is this still needed assuming #1256 is merged?

@WesleyBatista
Copy link
Contributor Author

I find quite useful have a CLI for query. Specifically this method because we are planning to use different orgs here.

@WesleyBatista
Copy link
Contributor Author

Maybe would be better if you merge #1256 first, then I make some changes to use the fork method from the model.Query.

@arikfr
Copy link
Member

arikfr commented Aug 30, 2016

I agree. I'll let you know once #1256 is merged.

@shahneil88
Copy link

shahneil88 commented Sep 20, 2016

@WesleyBatista - I added the modified code to my redash and tried replicating queries using CLI.

I receive below error.

`[2016-09-20 11:14:33,274][PID:4376][ERROR][peewee] SELECT "t1"."id", "t1"."updated_at", "t1"."created_at", "t1"."name", "t1"."slug", "t1"."settings" FROM "organizations" AS t1 WHERE ("t1"."slug" = %s) LIMIT 1 [u'default']

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/playhouse/postgres_ext.py", line 360, in execute_sql
cursor.execute(sql, params or ())

ProgrammingError: relation "organizations" does not exist
LINE 1: ...", "t1"."name", "t1"."slug", "t1"."settings" FROM "organizat...`

@shahneil88
Copy link

I resolved it with arik's help.
We need to add sudo -u redash bin/run prefix first time we run, which I missed.

@arikfr
Copy link
Member

arikfr commented Nov 23, 2016

@WesleyBatista #1256 was merged.

@arikfr
Copy link
Member

arikfr commented Jan 24, 2017

@WesleyBatista are you planning to update this or we can close it?

@WesleyBatista
Copy link
Contributor Author

Let's close it for now.

When I have the time I will try to add more functionality to our CLI :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants