You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+13-4
Original file line number
Diff line number
Diff line change
@@ -313,10 +313,14 @@ We can adjust batch update with these env variables (as in the docker-compose.ym
313
313
```
314
314
BATCH_SIZE: 50000 # number of records to update in one batch
315
315
```
316
+
### Update only one channel
317
+
Use env variable `CHANNEL` like in docker compose (string: tf1) with `UPDATE` to true
316
318
317
319
### Batch program data
318
320
`UPDATE_PROGRAM_ONLY` to true will only update program metadata, otherwise, it will update program metadata and all theme/keywords calculations.
319
321
322
+
`UPDATE_PROGRAM_CHANNEL_EMPTY_ONLY` to true will only update program metadata with empty value : "".
323
+
320
324
### Batch update from an offset
321
325
With +1 millions rows, we can update from an offset to fix a custom logic by using `START_DATE_UPDATE` (YYYY-MM-DD), the default will use the end of the month otherwise you can specify`END_DATE` (optional) (YYYY-MM-DD) to batch update PG from a date range.
322
326
@@ -335,10 +339,10 @@ Using [Alembic](https://alembic.sqlalchemy.org/en/latest/autogenerate.html) Auto
335
339
# If changes have already been applied (on your feature vranch) and you have to recreate your alembic file by doing :
336
340
# 1. change to your main branch
337
341
git switch main
338
-
# 2. start test container and run "pytest -vv -k api" to rebuild the state of the DB (or drop table the table you want)
342
+
# 2. start test container (docker compose up testconsole -d / docker compose exec testconsole bash) and run "pytest -vv -k api" to rebuild the state of the DB (or drop table the table you want) - just let it run a few seconds.
339
343
# 3. rechange to your WIP branch
340
344
git switch -
341
-
# 4. connect to the test container : docker compose up test -d / docker compose exec test bash
345
+
# 4. connect to the test container : docker compose up testconsole -d / docker compose exec testconsole bash
342
346
# 5. reapply the latest saved state :
343
347
poetry run alembic stamp head
344
348
# 6. Save the new columns
@@ -366,14 +370,18 @@ poetry run python3 quotaclimat/transform_excel_to_json.py
366
370
```
367
371
368
372
## Program Metadata table
369
-
The media perimeter is defined here : "quotaclimat/data_processing/mediatree/channel_program.json"
373
+
The media perimeter is defined here : "quotaclimat/data_processing/mediatree/channel_program_data.py"
374
+
375
+
To evolve the media perimeter, we use `program_grid_start` and `program_grid_end` columns to version all evolutions.
370
376
371
-
To calculate the right total duration for each channel, after updating "quotaclimat/data_processing/mediatree/channel_program.json" you need to execute this command to update `postgres/program_metadata.json`
377
+
To calculate the right total duration for each channel, after updating "quotaclimat/data_processing/mediatree/channel_program_data.py" you need to execute this command to update `postgres/program_metadata.json`
372
378
```
373
379
poetry run python3 transform_program.py
374
380
```
375
381
The SQL queries are based on this file that generate the Program Metadata table.
376
382
383
+
Program data will not be updated to avoid lock concurrent issues when using `UPDATE=true` for keywords logic. Note: The default case will update them.
384
+
377
385
**With the docker-entrypoint.sh this command is done automatically, so for production uses, you will not have to run this command.**
378
386
379
387
## Production monitoring
@@ -391,3 +399,4 @@ There is a debt regarding the cleanest of the code right now. Let's just not mak
0 commit comments