class_docstr: SQLAlchemy :class:`~sqlalchemy.orm.query.Query` subclass with some extra methods
  useful for querying in a web application.
  
  This is the default query class for :attr:`.Model.query`.
  
  .. versionchanged:: 3.0
      Renamed to ``Query`` from ``BaseQuery``.
class_docstr_tok: ["SQLAlchemy",":","class",":","`","~sqlalchemy.orm.query.Query","`","subclass","with","some","extra","methods","useful","for","querying","in","a","web","application",".","This","is","the","default","query","class","for",":","attr",":","`",".Model.query","`",".","..","versionchanged",":",":","3.0","Renamed","to","``","Query","``","from","``","BaseQuery","``","."]
docstr: Like :meth:`~sqlalchemy.orm.Query.get` but aborts with a ``404 Not Found``
  error instead of returning ``None``.
  
  :param ident: The primary key to query.
  :param description: A custom message to show on the error page.
docstr_tok: ["Like",":","meth",":","`","~sqlalchemy.orm.Query.get","`","but","aborts","with","a","``","404","Not","Found","``","error","instead","of","returning","``","None","``",".",":","param","ident",":","The","primary","key","to","query",".",":","param","description",":","A","custom","message","to","show","on","the","error","page","."]
code: def get_or_404(
      self, ident: t.Any, description: str | None = None
  ) -> t.Any:
      """Like :meth:`~sqlalchemy.orm.Query.get` but aborts with a ``404 Not Found``
      error instead of returning ``None``.
  
      :param ident: The primary key to query.
      :param description: A custom message to show on the error page.
      """
      rv = self.get(ident)
  
      if rv is None:
          abort(404, description=description)
  
      return rv
  
file_path: flask-sqlalchemy/src/flask_sqlalchemy/query.py
imports: from __future__ import annotations
  import typing
  import sqlalchemy.exc
  import sqlalchemy.orm
  from flask import abort
  from .pagination import Pagination
  from .pagination import QueryPagination
label_desc: Use image node_id 1 for calling the Query obj's underlying member method code with example usage: obj.get_or_404(ident, description) and returns: rv