Draft
Conversation
- Canviar import de urlparse amb try/except per suportar Python 2 i 3 - Gestió segura del port (try/except) per URLs sense port explícit - Eliminar dependència directa de urlparse (Python 2 only) Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Nou mètode insert_batch() que processa documents en lot - Captura errors individualment sense aturar el procés - Retorna llista de tracebacks dels errors trobats - Permet als backends fills sobreescriure amb implementacions optimitzades Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Arquitectura layered: capa Som Energia sobre nucli GISCE. Nucli GISCE (preservat): - _build_upsert_sql(): generació SQL dinàmica amb COALESCE - _prepare_cch_document(): preparació centralitzada de documents - _columns_cache: cache de columnes per performance - insert_cch(): interfície d'inserció individual Capa Som Energia (integrada): - get_as_utc_timestamp() amb suport DST i Illes Canàries (ES00316/ES04016) - Camps Odoo: create_uid, write_uid, create_date, write_date - Batch chunking (batch_size=500) per evitar saturar la DB - collection_prefix 'tg_' per les taules - Collections ampliades: f1, p1, cchfact, cchval, cch_gennetabeta, cch_autocons, giscedata_corbagen, giscedata_epfpf - Deduplicació dins de cada chunk per evitar errors ON CONFLICT Resolució d'upsert fields: - Models amb unique_fields/update_fields (EPFPF, CorbaGen): usen els del model - Models sense (F1, P1, etc.): fallback a name+utc_timestamp (+type per tg_p1) Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Acumular línies parsejades i inserir-les en batch al final - Canviar print statement per print() (compatibilitat Python 3) - Millora rendiment: una sola operació batch vs N insercions individuals Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Afegir psycopg2-binary a requirements.txt (driver PostgreSQL/TimescaleDB) - Afegir deploy/ a .gitignore Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Bump versió a 4.1.0 - Afegir autors: GISCE & Som Energia SCCL - Afegir long_description des de README.md - Afegir Clean command per netejar build/ - Afegir tests_require des de requirements-dev.txt - Afegir test_suite i provides - Afegir MANIFEST.in per distribució PyPI Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- python-tests.yml: matriu Python 2.7/3.11 amb pyenv, mamba + xmlrunner - python-publish.yml: publicació automàtica a PyPI amb tags vX.Y.Z - Mantenir workflows originals (python2.7-app.yml, python3.11-app.yml) Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests cobreixen: - _build_upsert_sql: SQL amb COALESCE, DO NOTHING, unique fields - get_as_utc_timestamp: Madrid, Canàries (ES00316/ES04016), DST estiu/hivern - get_utc_timestamp_from_datetime_and_season: conversió UTC amb season - _get_upsert_fields: resolució amb adapter fields vs fallback defaults - _insert_chunk: deduplicació dins del batch - insert_batch: collection_prefix, chunking per batch_size - _prepare_cch_document: UTC timestamps, camps Odoo, validated, datetime, name - BaseBackend.insert_batch: error handling sense aturar el procés - urlparse: compatibilitat Python 2/3, URLs amb/sense port - Configuració: collections Som+GISCE, batch_size, defaults tg_p1 Integració de cch_som: https://github.com/Som-Energia/cchloader Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Corregir AtributeError → AttributeError a _get_upsert_fields - Adaptar tests de compatibilitat al nou comportament: unique_fields obligatori als models TimescaleDB (sense fallback) - Tests que usaven MockAdapterNoUpsert amb insert_batch ara usen MockAdapter amb unique_fields explícits - Afegir tests que verifiquen que AttributeError es llença correctament Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objectius
Relacionat
Checklist