Use the sa alias for sqlalchemy everywhere

`sa` is the common alias, also in SQLAlchemy's own documentation
This commit is contained in:
Alexander Hess 2026-11-30 14:17:49 +01:00
commit e30b3efbe8
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -4,7 +4,7 @@ import json
import googlemaps
import pytest
import sqlalchemy as sqla
import sqlalchemy as sa
from geopy import distance
from sqlalchemy import exc as sa_exc
@ -73,7 +73,7 @@ class TestConstraints:
db_session.commit()
# Must delete without ORM as otherwise an UPDATE statement is emitted.
stmt = sqla.delete(db.Address).where(db.Address.id == path.first_address.id)
stmt = sa.delete(db.Address).where(db.Address.id == path.first_address.id)
with pytest.raises(
sa_exc.IntegrityError,
@ -87,7 +87,7 @@ class TestConstraints:
db_session.commit()
# Must delete without ORM as otherwise an UPDATE statement is emitted.
stmt = sqla.delete(db.Address).where(db.Address.id == path.second_address.id)
stmt = sa.delete(db.Address).where(db.Address.id == path.second_address.id)
with pytest.raises(
sa_exc.IntegrityError,
@ -103,7 +103,7 @@ class TestConstraints:
# Must insert without ORM as otherwise SQLAlchemy figures out
# that something is wrong before any query is sent to the database.
stmt = sqla.insert(db.Path).values(
stmt = sa.insert(db.Path).values(
first_address_id=address.id,
second_address_id=another_address.id,
city_id=999,
@ -123,7 +123,7 @@ class TestConstraints:
# Must insert without ORM as otherwise SQLAlchemy figures out
# that something is wrong before any query is sent to the database.
stmt = sqla.insert(db.Path).values(
stmt = sa.insert(db.Path).values(
first_address_id=path.first_address.id,
second_address_id=path.second_address.id,
city_id=path.city_id,