class_docstr: Parses the results of a SHOW CREATE TABLE statement.
class_docstr_tok: ["Parses","the","results","of","a","SHOW","CREATE","TABLE","statement","."]
docstr: Parse a KEY or CONSTRAINT line.
  
  :param line: A line of SHOW CREATE TABLE output
docstr_tok: ["Parse","a","KEY","or","CONSTRAINT","line",".",":","param","line",":","A","line","of","SHOW","CREATE","TABLE","output"]
code: def _parse_constraints(self, line):
      """Parse a KEY or CONSTRAINT line.
  
      :param line: A line of SHOW CREATE TABLE output
      """
  
      # KEY
      m = self._re_key.match(line)
      if m:
          spec = m.groupdict()
          # convert columns into name, length pairs
          # NOTE: we may want to consider SHOW INDEX as the
          # format of indexes in MySQL becomes more complex
          spec["columns"] = self._parse_keyexprs(spec["columns"])
          if spec["version_sql"]:
              m2 = self._re_key_version_sql.match(spec["version_sql"])
              if m2 and m2.groupdict()["parser"]:
                  spec["parser"] = m2.groupdict()["parser"]
          if spec["parser"]:
              spec["parser"] = self.preparer.unformat_identifiers(
                  spec["parser"]
              )[0]
          return "key", spec
  
      # FOREIGN KEY CONSTRAINT
      m = self._re_fk_constraint.match(line)
      if m:
          spec = m.groupdict()
          spec["table"] = self.preparer.unformat_identifiers(
              spec["table"]
          )
          spec["local"] = [
              c[0] for c in self._parse_keyexprs(spec["local"])
          ]
          spec["foreign"] = [
              c[0] for c in self._parse_keyexprs(spec["foreign"])
          ]
          return "fk_constraint", spec
  
      # CHECK constraint
      m = self._re_ck_constraint.match(line)
      if m:
          spec = m.groupdict()
          return "ck_constraint", spec
  
      # PARTITION and SUBPARTITION
      m = self._re_partition.match(line)
      if m:
          # Punt!
          return "partition", line
  
      # No match.
      return (None, line)
  
imports: import re
  from .enumerated import ENUM
  from .enumerated import SET
  from .types import DATETIME
  from .types import TIME
  from .types import TIMESTAMP
  from ...None import log
  from ...None import types
  from ...None import util
label_desc: Use image node_id 4 for calling the MySQLTableDefinitionParser obj's underlying member method code with example usage: obj._parse_constraints(line) and returns: None,  line, str,  spec, str,  spec, str,  spec, str,  line