From a179f7c861a6e4bf4ec368e29e97e66442475e49 Mon Sep 17 00:00:00 2001 From: tcezard Date: Wed, 3 Jul 2024 10:45:16 +0100 Subject: [PATCH] Actually create the table before populating it --- .../gather_clustering_counts/gather_release_counts.py | 6 +++--- .../gather_clustering_counts/release_count_models.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eva-accession-release-automation/gather_clustering_counts/gather_release_counts.py b/eva-accession-release-automation/gather_clustering_counts/gather_release_counts.py index 1f52f0c61..650d21946 100644 --- a/eva-accession-release-automation/gather_clustering_counts/gather_release_counts.py +++ b/eva-accession-release-automation/gather_clustering_counts/gather_release_counts.py @@ -353,10 +353,10 @@ def _write_per_taxonomy_and_assembly_counts(self, session): ) result = session.execute(query).fetchone() if result: - taxonomy_assembly_row = result.RSCountPerAssembly + taxonomy_assembly_row = result.RSCountPerTaxonomyAssembly else: - self.info(f"Create persistence for aggregate per assembly {assembly}") - taxonomy_assembly_row = RSCountPerAssembly( + self.info(f"Create persistence for aggregate per taxonomy {taxonomy} and assembly {assembly}") + taxonomy_assembly_row = RSCountPerTaxonomyAssembly( taxonomy_id=taxonomy, assembly_accession=assembly, release_folder=species_assembly_annotations.get((taxonomy, assembly)).get('release_folder'), diff --git a/eva-accession-release-automation/gather_clustering_counts/release_count_models.py b/eva-accession-release-automation/gather_clustering_counts/release_count_models.py index 45eed2e62..440783016 100644 --- a/eva-accession-release-automation/gather_clustering_counts/release_count_models.py +++ b/eva-accession-release-automation/gather_clustering_counts/release_count_models.py @@ -129,6 +129,7 @@ def get_sql_alchemy_engine(dbtype, username, password, host_url, database, port) RSCountCategory.__table__.create(bind=engine, checkfirst=True) RSCountPerAssembly.__table__.create(bind=engine, checkfirst=True) RSCountPerTaxonomy.__table__.create(bind=engine, checkfirst=True) + RSCountPerTaxonomyAssembly.__table__.create(bind=engine, checkfirst=True) return engine