Skip to main content
Data source class for populating date 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 DateRangeDataSource object.

Examples

A DateRangeDataSource 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 DateRangeParameter.

Usage example in parameters.py

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

Using a table from a specific connection

This example uses a table called “fiscal_periods” from the “analytics_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 “date_range_config”.

Using a custom date format

This example demonstrates using a different date format for the dates stored in the database.

Enabling cascading effects with a parent parameter

In this example, the date range is determined by the selected value of another parameter called “quarter”.