class_docstr: Testing export import functionality for dashboards
class_docstr_tok: ["Testing","export","import","functionality","for","dashboards"]
code: def create_table(
      self,
      name,
      schema=None,
      id=0,
      cols_names=[],
      cols_uuids=None,
      metric_names=[],
  ):
      database_name = "main"
      name = f"{NAME_PREFIX}{name}"
      params = {DBREF: id, "database_name": database_name}
  
      if cols_uuids is None:
          cols_uuids = [None] * len(cols_names)
  
      dict_rep = {
          "database_id": get_example_database().id,
          "table_name": name,
          "schema": schema,
          "id": id,
          "params": json.dumps(params),
          "columns": [
              {"column_name": c, "uuid": u}
              for c, u in zip(cols_names, cols_uuids)
          ],
          "metrics": [
              {"metric_name": c, "expression": ""} for c in metric_names
          ],
      }
  
      table = SqlaTable(
          id=id,
          schema=schema,
          table_name=name,
          params=json.dumps(params),
      )
      for col_name, uuid in zip(cols_names, cols_uuids):
          table.columns.append(
              TableColumn(column_name=col_name, uuid=uuid)
          )
      for metric_name in metric_names:
          table.metrics.append(
              SqlMetric(metric_name=metric_name, expression="")
          )
      return table, dict_rep
  
imports: import json
  import unittest
  from uuid import uuid4
  import yaml
  from tests.integration_tests.test_app import app
  from superset import db
  from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
  from superset.utils.database import get_example_database
  from superset.utils.dict_import_export import export_to_dict
  from .base_tests import SupersetTestCase
label_desc: Use image node_id 4 for calling the TestDictImportExport obj's underlying member method code with example usage: obj.create_table(name, schema, id, cols_names, cols_uuids, metric_names) and returns: table,  dict_rep