Skip to main content
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.

Constructor

Creates a NumberRangeDataSource object.

Examples

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.

Usage example in parameters.py

In addition, the following are some additional examples for creating a NumberRangeDataSource object.

Using a table from a specific connection

This example uses a table called “range_configs” from the “config_db” connection.
The connection must either be defined in squirrels.yml or the connections.py file.

Using seeds as the data source

This example uses a seed file called “number_range_config”.

Enabling cascading effects with a parent parameter

In this example, the range constraints and defaults are determined by the selected value of another parameter called “product_category”.