Interactive SQL playground for querying and visualizing data.
The playground
function allows you to create an interactive SQL playground within your application. It provides a dynamic interface for querying connected data sources and visualizing results directly.
label
(str): The display label for the playground component. This is used for identification and UI rendering.query
(str): The SQL query string to execute. This supports standard SQL syntax and can include SELECT
, JOIN
, WHERE
, etc.source
(str, optional): (Optional) The name of the specific data source to query. If not provided, the function attempts to auto-detect the data source from the SQL query itself. (See “Default Behavior for source
” below)size
(float): (Optional) The width of the component in a row. Defaults to 1.0
(full row).For example:
In this case, source
is auto-detected as users
.
Note: Auto-detection works best when the query has a clear FROM
or JOIN
clause.
pd.DataFrame
: The resulting DataFrame after executing the query. You can use it for further processing or visualization.Here’s how to create a simple playground:
Or, explicitly pass the data source:
The playground component:
source
when working with complex queries or joins.WHERE
clauses to limit large datasets.query()
: Executes SQL queries directlyget_df()
: Retrieves full datasetsInteractive SQL playground for querying and visualizing data.
The playground
function allows you to create an interactive SQL playground within your application. It provides a dynamic interface for querying connected data sources and visualizing results directly.
label
(str): The display label for the playground component. This is used for identification and UI rendering.query
(str): The SQL query string to execute. This supports standard SQL syntax and can include SELECT
, JOIN
, WHERE
, etc.source
(str, optional): (Optional) The name of the specific data source to query. If not provided, the function attempts to auto-detect the data source from the SQL query itself. (See “Default Behavior for source
” below)size
(float): (Optional) The width of the component in a row. Defaults to 1.0
(full row).For example:
In this case, source
is auto-detected as users
.
Note: Auto-detection works best when the query has a clear FROM
or JOIN
clause.
pd.DataFrame
: The resulting DataFrame after executing the query. You can use it for further processing or visualization.Here’s how to create a simple playground:
Or, explicitly pass the data source:
The playground component:
source
when working with complex queries or joins.WHERE
clauses to limit large datasets.query()
: Executes SQL queries directlyget_df()
: Retrieves full datasets