code: def extract_tables(sql):
      
      parsed = sqlparse.parse(sql)
      if not parsed:
          return []
  
      # INSERT statements must stop looking for tables at the sign of first
      # Punctuation. eg: INSERT INTO abc (col1, col2) VALUES (1, 2)
      # abc is the table name, but if we don't stop at the first lparen, then
      # we'll identify abc, col1 and col2 as table names.
      insert_stmt = parsed[0].token_first().value.lower() == 'insert'
      stream = extract_from_part(parsed[0], stop_at_punctuation=insert_stmt)
      return list(extract_table_identifiers(stream))
docs: Extract the table names from an SQL statment.
      Returns a list of (schema, table, alias) tuples