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

Examples

A DateDataSource 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 DateParameter.

Usage example in parameters.py

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

Using a table from a specific connection

This example uses a table called “fiscal_calendar” 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_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 default, minimum, and maximum dates are determined by the selected value of another parameter called “region”.