code: def get_physical_table_metadata(
      database: Database,
      table_name: str,
      normalize_columns: bool,
      schema_name: str | None = None,
  ) -> list[ResultSetColumnType]:
      """Use SQLAlchemy inspector to get table metadata"""
      db_engine_spec = database.db_engine_spec
      db_dialect = database.get_dialect()
      # ensure empty schema
      _schema_name = schema_name if schema_name else None
      # Table does not exist or is not visible to a connection.
  
      if not (
          database.has_table_by_name(
              table_name=table_name, schema=_schema_name
          )
          or database.has_view_by_name(
              view_name=table_name, schema=_schema_name
          )
      ):
          raise NoSuchTableError
  
      cols = database.get_columns(table_name, schema=_schema_name)
      for col in cols:
          try:
              if isinstance(col["type"], TypeEngine):
                  name = col["column_name"]
                  if not normalize_columns:
                      name = db_engine_spec.denormalize_name(
                          db_dialect, name
                      )
  
                  db_type = db_engine_spec.column_datatype_to_string(
                      col["type"], db_dialect
                  )
                  type_spec = db_engine_spec.get_column_spec(
                      db_type, db_extra=database.get_extra()
                  )
                  col.update(
                      {
                          "name": name,
                          "column_name": name,
                          "type": db_type,
                          "type_generic": type_spec.generic_type
                          if type_spec
                          else None,
                          "is_dttm": type_spec.is_dttm
                          if type_spec
                          else None,
                      }
                  )
          # Broad exception catch, because there are multiple possible exceptions
          # from different drivers that fall outside CompileError
          except Exception:  # pylint: disable=broad-except
              col.update(
                  {
                      "type": "UNKNOWN",
                      "type_generic": None,
                      "is_dttm": None,
                  }
              )
      return cols
  
imports: from __future__ import annotations
  import logging
  from collections.abc import Iterable, Iterator
  from functools import lru_cache
  from typing import Callable, TYPE_CHECKING, TypeVar
  from uuid import UUID
  from flask_babel import lazy_gettext
  from sqlalchemy.engine.url import URL
  from sqlalchemy.exc import NoSuchTableError
  from sqlalchemy.ext.declarative import DeclarativeMeta
  from sqlalchemy.orm import Session
  from sqlalchemy.orm.exc import ObjectDeletedError
  from sqlalchemy.sql.type_api import TypeEngine
  from superset.constants import LRU_CACHE_MAX_SIZE
  from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
  from superset.exceptions import SupersetGenericDBErrorException, SupersetSecurityException
  from superset.models.core import Database
  from superset.result_set import SupersetResultSet
  from superset.sql_parse import ParsedQuery
  from superset.superset_typing import ResultSetColumnType
label_desc: Use image node_id 1 for calling a global function with example usage: get_physical_table_metadata(database, table_name, normalize_columns, schema_name) and returns: cols