code: def query_with_expr_helper(self, is_timeseries, inner_join=True):
      tbl = self.get_table(name="birth_names")
      ds_col = tbl.get_column("ds")
      ds_col.expression = None
      ds_col.python_date_format = None
      spec = self.get_database_by_id(tbl.database_id).db_engine_spec
      if not spec.allows_joins and inner_join:
          # if the db does not support inner joins, we cannot force it so
          return None
      old_inner_join = spec.allows_joins
      spec.allows_joins = inner_join
      arbitrary_gby = "state || gender || '_test'"
      arbitrary_metric = dict(
          label="arbitrary",
          expressionType="SQL",
          sqlExpression="SUM(num_boys)",
      )
      query_obj = dict(
          groupby=[arbitrary_gby, "name"],
          metrics=[arbitrary_metric],
          filter=[],
          is_timeseries=is_timeseries,
          columns=[],
          granularity="ds",
          from_dttm=None,
          to_dttm=None,
          extras=dict(time_grain_sqla="P1Y"),
          series_limit=15 if inner_join and is_timeseries else None,
      )
      qr = tbl.query(query_obj)
      self.assertEqual(qr.status, QueryStatus.SUCCESS)
      sql = qr.query
      self.assertIn(arbitrary_gby, sql)
      self.assertIn("name", sql)
      if inner_join and is_timeseries:
          self.assertIn("JOIN", sql.upper())
      else:
          self.assertNotIn("JOIN", sql.upper())
      spec.allows_joins = old_inner_join
      self.assertFalse(qr.df.empty)
      return qr.df
  
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 3 for calling the TestSqlaTableModel obj's underlying member method code with example usage: obj.query_with_expr_helper(is_timeseries, inner_join) and returns: qr, None