# python-neo4j-cypher-scheduler

This workflow provides a simple interface to run Cypher queries on a schedule. This structure relies on files containing cypher queries that are placed in the `queries` directory. The value of the `NEO4J_SOURCE_NAME` environment variable should match the corresponding file name (minus the file extension), which should have the name of datastorename-datasourcename, e.g. mysql-pricing, snowflake-chartmetric. Files should contain the extension `.cypher`

Alternatively, if `NEO4J_SOURCE_FOLDER_NAME` is set, **all** Cypher files under the folder will be run.

For query result assertions like in [assert-data-quality](/queries/assert-data-quality/), the environment variable `ASSERT_RESULTS` must be set to `True`.

To continue running queries despite of errors, set `CONTINUE_AFTER_ERRORS` to `True`.

To run queries in batches, set `RUN_IN_BATCHES` to `True` and configure the `BATCH_SIZE`.


## Getting Started

### Setup Local Environment

For local development, copy the environment shadow file and make the necessary changes:

```shell
cp .env.shadow .env
```

Make sure your AWS credentials for dev are set in the environment, as the app requires access to Secrets Manager.

### Installation

Before starting make sure you have python3.11 installed.
An easy way to mange python versions is with pyenv.
```shell
$ brew update
$ brew install pyenv
$ pyenv install 3.11.2
$ pyenv local 3.11.2
```

Install the dependencies:

```shell
make env
```

### Conventions

* If you are adding/updating Identity nodes, please ensure the `id` is a valid UUID4 value. Do not re-use the `auth0UserId` for the `id` field.


### Testing

To run the linter and tests, all you have to do is to run:

```bash
make lint
make test
```

### Updating

To install new dependencies:

```bash
make env
```
