-
Notifications
You must be signed in to change notification settings - Fork 1
Remplissage des event_type et event_id #638
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
Conversation
for more information, see https://pre-commit.ci
…nto fill_event_id
for more information, see https://pre-commit.ci
print(f"Processing row: {row.rnb_id}") | ||
print(row.created_at, row.sys_period.lower) | ||
|
||
if not isinstance(row, BuildingHistoryOnly): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca peut arriver ça ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disons que c'est ceinture et bretelle. Quand j'ai vérifié il n'y avait que des BuildingHistoryOnly
mais j'ai préféré ajouter un contrôle au moment de la mise à jour.
app/batid/tasks.py
Outdated
total = 0 | ||
|
||
while True: | ||
# Fill empty event_type in batches of 50_000 rows | ||
# If no rows are updated, we can stop | ||
updated_rows = fill_empty_event_type(batch_size=50_000) | ||
total += updated_rows | ||
if updated_rows == 0: | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
j'aurais peut être créé une fonction dans fill_empty_event_type avec cette logique pour garder le code de tasks.py le plus bête possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je comprends mais est-ce que ça te va si on se dit que de toute façon c'est du code jetable et qu'on reste comme ça ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Justement s'il est jetable, je l'aurais bien regroupé avec le reste du code jetable, ce qui aurait permis par la suite de supprimer la tâche (qui aurait été une coquille vide) et de commenter tout le code de fill_empty_event_id.py.
Mais c'est du détail et je peux vivre avec :)
Par contre je vois que ces fichiers sont dans le répertoire data_fix
, mais ce ne sont pas des data_fix, au sens de "modifications de la base reliées à une ligne de la table data_fix".
Est-ce que tu peux les déplacer dans le répertoire contribution_fix
qui est à côté qui contient une modif qui ressemble (du type je désactive la trigger, je rattrape un truc, je réactive la trigger), quitte à renommer ce dossier (retroactive_database_operation
?)
|
||
|
||
class DBRouter(object): | ||
def db_for_write(self, model, **hints): | ||
if model == BuildingWithHistory or model == BuildingHistoryOnly: | ||
raise Exception("BuildingWithHistory model is read only!") | ||
# TEMPORARY DISABLED PROTECTION: fill_empty_event_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cf. commentaire https://github.com/fab-geocommuns/RNB-coeur/pull/642/files#r2144297480 qui m'a un peu interpelé
for more information, see https://pre-commit.ci
Il manque 78 000 000 de
event_id
sur les bâtiments et leur historique. Il manque également 114 000event_type
qui doivent être remplis avec "creation". Cette PR créé les deux tâches qui permettent de les remplir.A noter qu'il faut commencer par remplir les
event_type
puis remplir lesevent_id
.