Skip to content

Commit

Permalink
Address SQLAlchemy deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
smsearcy committed Jun 26, 2023
1 parent cebfd78 commit 6aad35d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions meshinfo/views/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def node_detail(request: Request):

query = (
dbsession.query(Link)
.options(joinedload(Link.destination).load_only("display_name"))
.options(joinedload(Link.destination).load_only(Node.display_name))
.filter(
Link.source_id == node.id,
Link.status != LinkStatus.INACTIVE,
Expand Down Expand Up @@ -90,7 +90,7 @@ def node_preview(request: Request):

query = (
dbsession.query(Link)
.options(joinedload(Link.destination).load_only("display_name"))
.options(joinedload(Link.destination).load_only(Node.display_name))
.filter(
Link.source_id == node.id,
Link.status == LinkStatus.CURRENT,
Expand All @@ -99,7 +99,7 @@ def node_preview(request: Request):
current_links = query.all()
query = (
dbsession.query(Link)
.options(joinedload(Link.destination).load_only("display_name"))
.options(joinedload(Link.destination).load_only(Node.display_name))
.filter(
Link.source_id == node.id,
Link.status == LinkStatus.RECENT,
Expand All @@ -126,7 +126,11 @@ def node_graphs(request: Request):
graph = request.matchdict["name"]
dbsession: Session = request.dbsession

node = dbsession.query(Node).options(load_only("display_name", "id")).get(node_id)
node = (
dbsession.query(Node)
.options(load_only(Node.display_name, Node.id))
.get(node_id)
)

return {
"node": node,
Expand Down

0 comments on commit 6aad35d

Please sign in to comment.