Skip to content

Commit

Permalink
update readme with docker deets
Browse files Browse the repository at this point in the history
  • Loading branch information
johnclary committed Feb 11, 2025
1 parent 1437cb0 commit 265d946
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions etl/run_sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@ This tool enables us to run arbitrary SQL using the Hasura [schema API](https://

2. Save a copy of the `env_template` file as `.env`, and fill in the graphql endpoint and admin secret. Note that the endpoint should end with `/v2/query` (see the [Hasura docs](https://hasura.io/docs/2.0/api-reference/schema-api/run-sql/) for more info).

3. Configure a python environment with `requests` installed.
3. Buld the Docker image, which provides the Python dependencies

```shell
docker build -t atddocker/vz-run-sql:latest
```
# see available commands
python run_sql.py -h
```

4. With the image built, you can mount yor local copy of the script into the container and run it, like so:

```shell
docker run -it --rm -v $PWD:/app --env-file .env atddocker/vz-run-sql:latest python run_sql.py -c refresh_location_crashes
```
# refresh location crashes
python run_sql.py -c refresh_location_crashes

5. To see all available sql commands that can be executed, use the `--help` flag

```shell
docker run -it --rm -v $PWD:/app --env-file .env atddocker/vz-run-sql:latest python run_sql.py --help
```

## Deployment + CI

A github action is configured to build and push this ETL's image to the Docker hub whenever files in this directory are changed.

The ETL itself is deployed via [atd-airflow](https://github.com/cityofaustin/atd-airflow).

0 comments on commit 265d946

Please sign in to comment.