code: def get_query_count(query_stmt: Select, *, session: Session) -> int:
      """Get count of query.
  
      A SELECT COUNT() FROM is issued against the subquery built from the
      given statement. The ORDER BY clause is stripped from the statement
      since it's unnecessary for COUNT, and can impact query planning and
      degrade performance.
  
      :meta private:
      """
      count_stmt = select(func.count()).select_from(
          query_stmt.order_by(None).subquery()
      )
      return session.scalar(count_stmt)
  
imports: from __future__ import annotations
  import contextlib
  import enum
  import json
  import logging
  import os
  import sys
  import time
  import warnings
  from dataclasses import dataclass
  from tempfile import gettempdir
  from typing import TYPE_CHECKING, Callable, Generator, Iterable
  from sqlalchemy import Table, and_, column, delete, exc, func, inspect, literal, or_, select, table, text, tuple_
  import airflow
  from airflow import settings
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException
  from airflow.models import import_all_models
  from airflow.utils import helpers
  from airflow.utils.session import NEW_SESSION, create_session, provide_session
label_desc: Use image node_id 45 for calling a global function with example usage: get_query_count(query_stmt) and returns: session