Re-evaluate a SQL query written in mode by setting the liquid variables from Python Notebook


We would like to know if it's possible to re-evaluate a SQL query written in mode by setting the liquid variables from Python.

We have to build a dataset using data from two different databases. Our plan is to query database 1 and then use the returned dataset in python to do some data processing. From there, we want to query database 2 using some of the processed data in python and then include the results in the report builder.



Teodor Mihail Costica

1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hey Teodor!

    There's no way to do this natively using Python in Mode notebooks. That said, you could conceivably achieve this using some API chaining involving two reports:

    • Run the first report via the API: POST Report Runs. This will hand back an object representing the report run.
    • Parse the CSV outputs of the above object, and process these via Python on your end to obtain the desired input for the second report.
    • Run the second report via the API, passing it the above parameters:
      POST Report Runs

    I hope that helps - thanks!

    Reply Like
Like Follow
  • Status Answered
  • 3 wk agoLast active
  • 1Replies
  • 24Views
  • 2 Following

Create A New Discussion

Share your thoughts