question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom SQL queries with filters

See original GitHub issue

Is it possible to specify custom SQL query like using SQL Lab but with an opportunity to apply interactive FilterBox to it?

It would be really nice in tasks where you have to visualize aggregative metrics. For example, if you have smth like that: user1, log1, user2, log2, … userN, logM

And you want to plot a distribution of counters of logs for users in a following way:

SELECT counter, COUNT(*)
FROM
(SELECT user, COUNT(*) AS counter 
FROM table_name 
WHERE conditions_from_interactive_filter_box 
GROUP BY user
) AS foo
GROUP BY counter;

If I am not mistaken you can not do it directly from Superset slices but it is a very common case.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
thuylevncommented, Mar 1, 2019

Hi all, I am using superset. Do you know how to Get value of Grain in filter from a query ( as a parameter {{ ??? }} )?

image

1reaction
ksaagariconiccommented, Aug 1, 2018

Hello there - We had a huge stack of our reports built using 0.20.4 which let us use custom filters that were not part of the data source in our queries, and now when we upgrade to 0.24.3 or higher we find that these custom filters are rejected or made blank at the jinja_parser stage.

Question - Is there a reason this change was done to exclude external custom filters, because we are wondering if there has been a more elegant and cleaner way to do this?

We are concerned that this feature might have been completely deprecated which sometimes aggravates our use cases by pulling a lot more data at every pull and making all the dashboards slower. Can someone please help? Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to put filter value in custom SQL query
I have a very large table...almost billion rows. What I want to do is create a custom SQL query where a user enters...
Read more >
Filters in Custom SQL - Get Help
We want to know how the filters work on custom SQL queries. Suppose we use the table data directly, we are able to...
Read more >
Filtering rows from SQL Server
This example shows how to use a sub query in a Custom SQL filter to give different users access to specific regions. The...
Read more >
Custom SQL Query, Filter List, Based On 2 Different ...
I have a way to list all of the devices that are currently polling volumes. And, I have a way to list the...
Read more >
SQL Filtering by Custom Column
SELECT * FROM ( SELECT DISTINCT ManagerName , ProductName , slocumrank , case when SubType2ID = 45 then 'Large Cap' else SubType2Name End...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found