code: def test_data_for_slices_with_adhoc_column(self):
      # should perform sqla.model.BaseDatasource.data_for_slices() with adhoc
      # column and legacy chart
      tbl = self.get_table(name="birth_names")
      dashboard = self.get_dash_by_slug("births")
      slc = Slice(
          slice_name="slice with adhoc column",
          datasource_type=DatasourceType.TABLE,
          viz_type="table",
          params=json.dumps(
              {
                  "adhoc_filters": [],
                  "granularity_sqla": "ds",
                  "groupby": [
                      "name",
                      {
                          "label": "adhoc_column",
                          "sqlExpression": "name",
                      },
                  ],
                  "metrics": ["sum__num"],
                  "time_range": "No filter",
                  "viz_type": "table",
              }
          ),
          datasource_id=tbl.id,
      )
      dashboard.slices.append(slc)
      datasource_info = slc.datasource.data_for_slices([slc])
      assert "database" in datasource_info
  
      # clean up and auto commit
      metadata_db.session.delete(slc)
  
imports: import json
  from superset.utils.core import DatasourceType
  import textwrap
  import unittest
  from unittest import mock
  from superset import security_manager
  from superset.connectors.sqla.models import SqlaTable
  from superset.exceptions import SupersetException
  from superset.utils.core import override_user
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  import pytest
  from sqlalchemy.engine.url import make_url
  from sqlalchemy.types import DateTime
  import tests.integration_tests.test_app
  from superset import app, db
  from superset.db_engine_specs.postgres import PostgresEngineSpec
  from superset.common.db_query_status import QueryStatus
  from superset.models.core import Database
  from superset.models.slice import Slice
  from superset.utils.database import get_example_database
  from .base_tests import SupersetTestCase
  from .fixtures.energy_dashboard import load_energy_table_with_slice, load_energy_table_data
label_desc: Use image node_id 11 for calling the TestSqlaTableModel obj's underlying member method code with example usage: obj.test_data_for_slices_with_adhoc_column() without return types