docs: def _from_sql(self, soql):
          """Create Force.com SOQL tree structure from SOQL"""
          # pylint:disable=too-many-branches,too-many-nested-blocks
          assert not self.soql, "Don't use _from_sql method directly"
          self.soql = soql
          soql, self.subqueries = split_subquery(soql)
          match_parse = re.match(r'SELECT (.*) FROM (\w+)\b(.*)$', soql, re.I)
          if not match_parse:
              raise ProgrammingError('Invalid SQL: %s' % self.soql)
          fields_sql, self.root_table, self.extra_soql = match_parse.groups()
          fields = [x.strip() for x in fields_sql.split(',')]
          self.is_aggregation = bool(pattern_groupby.search(self.extra_soql) or
                                     pattern_aggregation.search(fields[0]))
          self.is_plain_count = fields[0].upper() == 'COUNT()'
          consumed_subqueries = 0
          expr_alias_counter = 0
          #
          if not self.is_plain_count:
              for field in fields:
                  if self.is_aggregation:
                      match = re.search(r'\b\w+$', field)
                      if match:
                          alias = match.group()
                          assert alias not in RESERVED_WORDS, "invalid alias name"
                          if match.start() > 0 and field[match.start() - 1] == ' ':
                              field = field[match.start() - 1]
                      else:
                          alias = 'expr{}'.format(expr_alias_counter)
                          expr_alias_counter += 1
                      assert '&' not in field, "Subquery not expected as field in aggregation query"
                  elif '&' in field:
                      assert field == '(&)'  # verify that the subquery was in parentheses
                      subquery = QQuery(self.subqueries[consumed_subqueries][0])
                      consumed_subqueries += 1
                      self.has_child_rel_field = True
                      field = subquery
                      # TODO more child relationships to the same table
                      alias = subquery.root_table
                  else:
                      alias = field
                      if '.' in alias:
                          if alias.split('.', 1)[0].lower() == self.root_table.lower():
                              alias = alias.split('.', 1)[1]
                          if '.' in alias:
                              # prepare paths for possible empty outer joins
                              subroots = self.subroots
                              root_crumbs = alias.lower().split('.')[:-1]
                              for scrumb in root_crumbs:
                                  subroots.setdefault(scrumb, {})
                                  subroots = subroots[scrumb]
                  self.aliases.append(alias)
                  self.fields.append(field)