Many resolvers generate features by connecting to external, production-like systems (e.g. databases and APIs). It can be challenging to validate these resolvers since they involve communication between several systems. This guide will help you execute resolvers that communicate with those external systems on your local environment.
Chalk’s datasource integrations operate by assuming certain environment variables exist which provide integration information (such as urls, passwords, etc.) to the python code. When executing these resolvers locally, you’ll need to replicate those environment variables. For the following guide lets assume a single Postgres datasource named “PG”.
PG_PGHOST=database-1.myproject.us-west-1.rds.amazon.com PG_PGPORT=5432 PG_PGDATABASE=db PG_PGUSER=postgres PG_PGPASSWORD=password
Once the environment variables are setup correctly, you can execute your resolver like any python code.
For example if the file
chalkproject/resolvers.py includes a resolver like
get_transactions_from_snowflake, you can execute it any python environment.
$ source .venv/bin/activate $ (.venv) python >>> from chalkproject.resolvers import get_transactions_from_snowflake >>> get_transactions_from_snowflake()