diff --git a/database/engine.py b/database/engine.py index 864587723..90dbda95b 100644 --- a/database/engine.py +++ b/database/engine.py @@ -54,7 +54,7 @@ def create_session(self): timeseries_engine = self.timeseries_engine class RoutingSession(Session): - def get_bind(self, mapper=None, clause=None): + def get_bind(self, mapper=None, clause=None, **kw): if mapper is not None and issubclass( mapper.class_, TimeseriesBaseModel ): diff --git a/database/tests/unit/test_engine.py b/database/tests/unit/test_engine.py index a5665a279..44b6148ab 100644 --- a/database/tests/unit/test_engine.py +++ b/database/tests/unit/test_engine.py @@ -39,6 +39,7 @@ def test_session_get_bind_timeseries_enabled(self, sqlalchemy_connect_url, mocke database_url=sqlalchemy_connect_url, timeseries_database_url=sqlalchemy_connect_url, ) + session = session_factory.create_session() assert session_factory.main_engine is not None assert session_factory.timeseries_engine is not None diff --git a/docker/test_codecov_config.yml b/docker/test_codecov_config.yml index 4f729f3fb..b567f5fb0 100644 --- a/docker/test_codecov_config.yml +++ b/docker/test_codecov_config.yml @@ -5,8 +5,8 @@ setup: encryption_secret: "zp^P9*i8aR3" services: - database_url: postgres://postgres:password@postgres:5432/postgres - timeseries_database_url: postgres://postgres:password@timescale:5432/postgres + database_url: postgresql://postgres:password@postgres:5432/postgres + timeseries_database_url: postgresql://postgres:password@timescale:5432/postgres redis_url: redis://redis:6379 minio: hash_key: testixik8qdauiab1yiffydimvi72ekq # never change this diff --git a/tasks/delete_owner.py b/tasks/delete_owner.py index fa7073164..bc73ff739 100644 --- a/tasks/delete_owner.py +++ b/tasks/delete_owner.py @@ -67,7 +67,7 @@ def delete_from_database(self, db_session, owner): ) db_session.commit() log.info("Deleting repos from DB", extra=dict(ownerid=ownerid)) - involved_repos.delete() + db_session.query(Repository).filter(Repository.ownerid == ownerid).delete() db_session.commit() log.info("Setting other owner bots to NULL", extra=dict(ownerid=ownerid)) db_session.query(Owner).filter(Owner.bot_id == ownerid).update( @@ -77,7 +77,7 @@ def delete_from_database(self, db_session, owner): log.info( "Cleaning repos that have this owner as bot", extra=dict(ownerid=ownerid) ) - db_session.query(Repository.repoid).filter(Repository.bot_id == ownerid).update( + db_session.query(Repository).filter(Repository.bot_id == ownerid).update( {Repository.bot_id: None}, synchronize_session=False ) db_session.commit()