class_docstr: A slice is essentially a report or a view on data
class_docstr_tok: ["A","slice","is","essentially","a","report","or","a","view","on","data"]
code: def get_datasource(self) -> BaseDatasource | None:
      return (
          db.session.query(self.cls_model)
          .filter_by(id=self.datasource_id)
          .one_or_none()
      )
  
imports: from __future__ import annotations
  import json
  import logging
  from typing import Any, TYPE_CHECKING
  from urllib import parse
  import sqlalchemy
  from flask_appbuilder import Model
  from flask_appbuilder.models.decorators import renders
  from markupsafe import escape, Markup
  from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String, Table, Text
  from sqlalchemy.engine.base import Connection
  from sqlalchemy.orm import relationship
  from sqlalchemy.orm.mapper import Mapper
  from superset import db, is_feature_enabled, security_manager
  from superset.legacy import update_time_range
  from superset.models.helpers import AuditMixinNullable, ImportExportMixin
  from superset.tasks.thumbnails import cache_chart_thumbnail
  from superset.tasks.utils import get_current_user
  from superset.thumbnails.digest import get_chart_digest
  from superset.utils import core
  from superset.viz import BaseViz, viz_types
label_desc: Use image node_id 5 for calling the Slice obj's underlying member method code with example usage: obj.get_datasource() and returns: db