Use the sa alias for sqlalchemy everywhere
`sa` is the common alias, also in SQLAlchemy's own documentation
This commit is contained in:
parent
a85ba4c4c4
commit
e30b3efbe8
1 changed files with 29 additions and 29 deletions
|
|
@ -4,7 +4,7 @@ import datetime as dt
|
|||
import random
|
||||
|
||||
import pytest
|
||||
import sqlalchemy as sqla
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import exc as sa_exc
|
||||
|
||||
from tests import config as test_config
|
||||
|
|
@ -58,7 +58,7 @@ class TestConstraints:
|
|||
db_session.commit()
|
||||
|
||||
# Must delete without ORM as otherwise an UPDATE statement is emitted.
|
||||
stmt = sqla.delete(db.Customer).where(db.Customer.id == order.customer.id)
|
||||
stmt = sa.delete(db.Customer).where(db.Customer.id == order.customer.id)
|
||||
|
||||
with pytest.raises(sa_exc.IntegrityError, match="fk_orders_to_customers"):
|
||||
db_session.execute(stmt)
|
||||
|
|
@ -69,7 +69,7 @@ class TestConstraints:
|
|||
db_session.commit()
|
||||
|
||||
# Must delete without ORM as otherwise an UPDATE statement is emitted.
|
||||
stmt = sqla.delete(db.Courier).where(db.Courier.id == order.courier.id)
|
||||
stmt = sa.delete(db.Courier).where(db.Courier.id == order.courier.id)
|
||||
|
||||
with pytest.raises(sa_exc.IntegrityError, match="fk_orders_to_couriers"):
|
||||
db_session.execute(stmt)
|
||||
|
|
@ -80,7 +80,7 @@ class TestConstraints:
|
|||
db_session.commit()
|
||||
|
||||
# Must delete without ORM as otherwise an UPDATE statement is emitted.
|
||||
stmt = sqla.delete(db.Restaurant).where(db.Restaurant.id == order.restaurant.id)
|
||||
stmt = sa.delete(db.Restaurant).where(db.Restaurant.id == order.restaurant.id)
|
||||
|
||||
with pytest.raises(sa_exc.IntegrityError, match="fk_orders_to_restaurants"):
|
||||
db_session.execute(stmt)
|
||||
|
|
@ -112,7 +112,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 == order.delivery_address.id)
|
||||
stmt = sa.delete(db.Address).where(db.Address.id == order.delivery_address.id)
|
||||
|
||||
with pytest.raises(sa_exc.IntegrityError, match="fk_orders_to_addresses"):
|
||||
db_session.execute(stmt)
|
||||
|
|
|
|||
Loading…
Reference in a new issue