Use this file to discover all available pages before exploring further.
Data source class for populating number range parameter options from a database table or query.This class can be imported from the squirrels.data_sources or the squirrels module.
Either the name of the table to use, or a SQL query to run. If using a SQL query, it must start with “SELECT” (ignoring case and leading whitespaces) followed by a whitespace.The available tables are based on the source argument. If the source is SourceEnum.CONNECTION, then the SQL syntax is based on the underlying database from the connection argument. Otherwise, the SQL syntax is DuckDB SQL.
Name of the connection to use. Only used if the source is SourceEnum.CONNECTION. Connection must be defined in squirrels.yml or the connections.py file.If None, uses the default connection (specified by SQRL_CONNECTIONS__DEFAULT_NAME_USED environment variable or ‘default’).
A NumberRangeDataSource object is created in the pyconfigs/parameters.py file. It must be created in a function decorated with the create_from_source factory method from NumberRangeParameter.
from squirrels import parameters as p, data_sources as ds@p.NumberRangeParameter.create_from_source( name="price_range", label="Price Range", description="Filter products by price range")def price_range_source(): return ds.NumberRangeDataSource( table_or_query=""" SELECT 0 AS min_price, 1000 AS max_price, 10 AS price_step, 100 AS default_lower, 500 AS default_upper """, min_value_col="min_price", max_value_col="max_price", increment_col="price_step", default_lower_value_col="default_lower", default_upper_value_col="default_upper" )
In addition, the following are some additional examples for creating a NumberRangeDataSource object.