Skip to content

Commit

Permalink
Fix SQLAlchemy upgrade incompatibilities
Browse files Browse the repository at this point in the history
There's a few things that were fixed for the SQLAlchemy upgrade.
  • Loading branch information
michelletran-codecov committed Nov 19, 2024
1 parent 66a4d07 commit 4798087
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion database/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
1 change: 1 addition & 0 deletions database/tests/unit/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker/test_codecov_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tasks/delete_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down

0 comments on commit 4798087

Please sign in to comment.