Skip to main content

An easier way to use custom parameters in ehrQL

Posted:

We’ve made it easier to pass custom parameters to ehrQL, so that you can reuse your ehrQL code more effectively.

Parameters can be passed from a pipeline action:

version: '4.0'

actions:
  generate_dataset:
    run: ehrql:v1 generate-dataset dataset_definition.py --output output/dataset.arrow
      --
      --start_date 2025-01-01
    ...

And then defined and used in an ehrQL python file:

from ehrql import get_parameter

start_date = get_parameter("start_date")

For more information on how to use custom parameters in your ehrQL, see the reference documentation and the How To guide