using dashboard filters inside R/Python Code

Is there a way of using the dashboad filters (i.e. daterange) inside the R/Python code instead of using it directly in the SQL?



2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi diego! The best way to handle this is to pass your filter values in as a column via your SQL output, so you can then leverage these parameters in your Python/R script.

    Example: Let's say I have a filter called "Customer_ID" that I want to use in my Python code.

    In SQL, you can write

    select <columns>, [Customer_ID] as cust_id from table ....

    This creates a table with your SQL output, with an additional column that contains the value selected in the Customer_ID filter. From there, you can reference df['cust_id'] to pull the actual filter values for your analysis.

    Reply Like
  • Python is a versatile programming language that can do everything from data mining to plotting graphs. Its design philosophy is based on the importance of readability and simplicity.

    String query = "SELECT * FROM table";
    ResultSet results = session.execute(query);

    Reply Like
Like Follow
  • 1 yr agoLast active
  • 2Replies
  • 1037Views
  • 3 Following