code: def get_all_tables(stmt):
      if isinstance(stmt, Union):
          left = get_all_tables(stmt.left)
          right = get_all_tables(stmt.right)
          return left + right
  
      if isinstance(stmt, Select):
          from_stmt = stmt.from_table
      elif isinstance(stmt, (Identifier, Join)):
          from_stmt = stmt
      elif isinstance(stmt, Insert):
          from_stmt = stmt.table
      elif isinstance(stmt, Delete):
          from_stmt = stmt.table
      else:
          # raise SqlApiException(f'Unknown type of identifier: {stmt}')
          return []
  
      result = []
      if isinstance(from_stmt, Identifier):
          result.append(from_stmt.parts[-1])
      elif isinstance(from_stmt, Join):
          result.extend(get_all_tables(from_stmt.left))
          result.extend(get_all_tables(from_stmt.right))
      return result
  
imports: from functools import partial
  import pandas
  from mindsdb_sql.parser.ast import BinaryOperation, Constant, Identifier, Select, Join, Union, Insert, Delete
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb.api.executor.datahub.classes.tables_row import TABLES_ROW_TYPE, TablesRow
  from mindsdb.api.executor.datahub.datanodes.datanode import DataNode
  from mindsdb.api.executor.datahub.datanodes.integration_datanode import IntegrationDataNode
  from mindsdb.api.executor.datahub.datanodes.project_datanode import ProjectDataNode
  from mindsdb.api.executor import exceptions
  from mindsdb.api.executor.utilities.sql import query_df
  from mindsdb.interfaces.agents.agents_controller import AgentsController
  from mindsdb.interfaces.database.projects import ProjectController
  from mindsdb.interfaces.jobs.jobs_controller import JobsController
  from mindsdb.interfaces.skills.skills_controller import SkillsController
  from mindsdb.utilities import log
label_desc: Use image node_id 1 for calling a global function with example usage: get_all_tables(stmt) and returns: result, unknown, list