docs: def get_relations(self, cursor, table_name):
          """
          Returns a dictionary of {field_index: (field_index_other_table, other_table)}
          representing all relationships to the given table. Indexes are 0-based.
          """
          # CONSTRAINT_COLUMN_USAGE: http://msdn2.microsoft.com/en-us/library/ms174431.aspx
          # CONSTRAINT_TABLE_USAGE:  http://msdn2.microsoft.com/en-us/library/ms179883.aspx
          # REFERENTIAL_CONSTRAINTS: http://msdn2.microsoft.com/en-us/library/ms179987.aspx
          # TABLE_CONSTRAINTS:       http://msdn2.microsoft.com/en-us/library/ms181757.aspx
  
          table_index = self._name_to_index(cursor, table_name)
          sql = """
  SELECT e.COLUMN_NAME AS column_name,
    c.TABLE_NAME AS referenced_table_name,
    d.COLUMN_NAME AS referenced_column_name
  FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS a
  INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS b
    ON a.CONSTRAINT_NAME = b.CONSTRAINT_NAME
  INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE AS c
    ON b.UNIQUE_CONSTRAINT_NAME = c.CONSTRAINT_NAME
  INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS d
    ON c.CONSTRAINT_NAME = d.CONSTRAINT_NAME
  INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS e
    ON a.CONSTRAINT_NAME = e.CONSTRAINT_NAME
  WHERE a.TABLE_NAME = %s AND a.CONSTRAINT_TYPE = 'FOREIGN KEY'"""
          cursor.execute(sql, (table_name,))
          return dict([(table_index[item[0]], (self._name_to_index(cursor, item[1])[item[2]], item[1]))
                       for item in cursor.fetchall()])