-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧑🤝🧑 Dédup v2 amélioration data parent (#1160)
* initial commit * clarification de l'inclusion * migration typing minuscule * exclusion des champs cree_le et modifie_le * ajout ECODDS à l'exclusion du nom_commercial
- Loading branch information
1 parent
744b73d
commit 5283c1e
Showing
4 changed files
with
343 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Utilitaires pour les interactions DB""" | ||
|
||
from functools import cache | ||
|
||
from qfdmo.models.acteur import Source | ||
|
||
|
||
# A propos de @cache: | ||
# Données de très petite taille donc unbounded cache est OK | ||
# Raison pour le cache: | ||
# - pouvoir utiliser le mapping dans des sous-tâches sans | ||
# avoir à se trimballer des arguments partout | ||
# (manage cluster -> manage parent) | ||
# - gain de performance: au 2024-12-18 il nous faut 2h23min pour | ||
# traiter n=4700 clusters, preuve que l'accès DB est assez lent | ||
# et donc économiser n=requêtes (mapping utilisé à la fois dans | ||
# db_manage_cluster et db_manage_parent) ne parait pas scandaleux | ||
@cache | ||
def db_source_ids_by_code_get() -> dict: | ||
"""Récupération de la liste des sources par code pour les utiliser | ||
dans la logique de priorisation des sources pour la fusion des données | ||
Returns: | ||
result: dict de sources code:id | ||
""" | ||
return dict(Source.objects.values_list("code", "id")) |
Oops, something went wrong.