Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/range setup fixes #18

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EVIDENCE_DATABASE=duckdb
EVIDENCE_DUCKDB_FILENAME=octocatalog.db
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ More install methods are [detailed in the Task docs](https://taskfile.dev/instal

Tasks included are:

```shell
task extract # pull data from github archive for the past day into the data/ directory
task load # load data from the data/ directory into duckdb
task transform # run the dbt transformations
task [*]-prod # all tasks can be run in a 'prod-mode' against a MotherDuck cloud warehouse
task bi # serve the Evidence project locally for development
```
| Task | Description |
|----------|----------|
| `task setup` | Setups up all required tools to run the stack |
| `task extract` | pull data from github archive for the past day into the data/ directory |
| `task load` | load data from the data/ directory into duckdb |
| `task transform` | run the dbt transformations |
| `task [*]-prod` | all tasks can be run in a 'prod-mode' against a MotherDuck cloud warehouse |
| `task bi` | serve the Evidence project locally for development |

### 🐍 Running the EL script directly 🏗️

Expand Down
6 changes: 6 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ tasks:
load-prod:
cmds:
- python3 el.py -lp
transform-setup:
cmds:
- dbt deps
transform:
cmds:
- dbt build
Expand All @@ -27,6 +30,9 @@ tasks:
cmds:
- python3 el.py -elp
- dbt build --target prod
bi-setup:
cmds:
- npm --prefix ./reports install
bi:
cmds:
- npm run dev --prefix ./reports
Expand Down
4 changes: 2 additions & 2 deletions el.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ def load_data():
parser.add_argument(
"start_datetime",
help="The start date of the range",
default=datetime.strftime(datetime.now() - timedelta(hours=1), "%Y-%m-%d-%H"),
default=datetime.strftime(datetime.utcnow() - timedelta(hours=1), "%Y-%m-%d-%H"),
nargs="?",
type=validate_date,
)
parser.add_argument(
"end_datetime",
help="The end date of the range (inclusive)",
default=datetime.strftime(datetime.now(), "%Y-%m-%d-%H"),
default=datetime.strftime(datetime.utcnow(), "%Y-%m-%d-%H"),
nargs="?",
type=validate_date,
)
Expand Down
4 changes: 2 additions & 2 deletions reports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ If you see `✗ orders_by_month Missing database credentials`, you need to add t

1. Open the settings menu at [localhost:3000/settings](http://localhost:3000/settings)
2. select `DuckDB`
3. enter `needful_things`
4. select `.duckdb` and save
3. enter `octocatalog`
4. select `.db` and save

## Learning More

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ruff~=0.0.291
sqlfluff-templater-dbt~=2.3.2
sqlfluff~=2.3.2
tqdm~=4.66.1
duckdb~=0.8.1