Changelog

Our latest product additions and improvements.

chevron icon
All updates

🌯 Access Queries in Worklets

March 1, 2022

You’re now able to access queries from a code block in a Worklet! These queries can be in the form of raw SQL (as a string) or a name of a query you’ve defined earlier.

For example:

new_query_output = context.run_query_str("select * from test_table") # to run raw SQL queries

existing_query_output = context.run_query_name("testquery") # to run a specific query you’ve already defined

These examples show queries against Baseten Postgres data tables. If you’d like to query external data sources you have connected to your Baseten account, check out our documentation.

To access the results of your queries, either return or print their output (new_query_output, existing_query_output) from your code block!