Skip to content

Commit

Permalink
♻️ REFACTOR: Remove QueryManager (#5101)
Browse files Browse the repository at this point in the history
The `AbstractQueryManager` class and its implementations, 
`DjangoQueryManager` and `SqlaQueryManager`, is an odd mix of a few
methods, with no real conceptual purpose; essentially a catch-all for
things that didn't have another home.

In this PR, the classes are removed and their methods are reassigned as
appropriate:

 * `get_creation_statistics` has been moved to the `BackendQueryBuilder`
 * `get_duplicate_uuids` and `apply_new_uuid_mapping` have been moved to
   `aiida/backends/general/migrations/duplicate_uuids.py`. They were
   defined both in `aiida/backends/general/migrations/utils.py` as well
   as in `aiida/manage/database/integrity/duplicate_uuid.py`. Note that
   the former had been adapted after the repository redesign, but the
   latter was omitted by mistake. The latter is now correctly updated to
   contain compatibility for the new repository. Since the methods
   directly use SQL, they cannot be easily abstracted and moved to the
   `BackendQueryBuilder`.
 * `get_bands_and_parents_structure` has been moved to the ORM module
   in `aiida/orm/nodes/data/array/bands.py`.
  • Loading branch information
chrisjsewell authored Sep 2, 2021
1 parent aea9bfe commit 1dac2fe
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 729 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def verify_node_uuid_uniqueness(_, __):
:raises: IntegrityError if database contains nodes with duplicate UUIDS.
"""
from aiida.backends.general.migrations.utils import verify_uuid_uniqueness
from aiida.backends.general.migrations.duplicate_uuids import verify_uuid_uniqueness
verify_uuid_uniqueness(table='db_dbnode')


Expand Down
2 changes: 1 addition & 1 deletion aiida/backends/djsite/db/migrations/0018_django_1_11.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _verify_uuid_uniqueness(apps, schema_editor):
:raises: IntegrityError if database contains rows with duplicate UUIDS.
"""
# pylint: disable=unused-argument
from aiida.manage.database.integrity.duplicate_uuid import verify_uuid_uniqueness
from aiida.backends.general.migrations.duplicate_uuids import verify_uuid_uniqueness

for table in tables:
verify_uuid_uniqueness(table=table)
Expand Down
229 changes: 0 additions & 229 deletions aiida/backends/djsite/queries.py

This file was deleted.

Loading

0 comments on commit 1dac2fe

Please sign in to comment.