Generates columns that are being used in child elements of the delete query
    this will be used to determine tables for the using clause.
    :param root: the delete query
    :return: a generator of columns
969654
def gen_columns_from_children(root):
    
    if isinstance(root, (Delete, BinaryExpression, BooleanClauseList)):
        for child in root.get_children():
            yc = gen_columns_from_children(child)
            for it in yc:
                yield it
    elif isinstance(root, sa.Column):
        yield root
385861
def root(self):
        
        root = self
        while root.parent is not None:
            root = root.parent
        return root
292881
def _delete_null_columns(self, conditionals=None):
        
        ds = DeleteStatement(self.column_family_name, conditionals=conditionals, if_exists=self._if_exists)
        deleted_fields = False
        static_only = True
        for _, v in self.instance._values.items():
            col = v.column
            if v.deleted:
                ds.add_field(col.db_field_name)
                deleted_fields = True
                static_only &= col.static
            elif isinstance(col, columns.Map):
                uc = MapDeleteClause(col.db_field_name, v.value, v.previous_value)
                if uc.get_context_size() > 0:
                    ds.add_field(uc)
                    deleted_fields = True
                    static_only |= col.static

        if deleted_fields:
            keys = self.model._partition_keys if static_only else self.model._primary_keys
            for name, col in keys.items():
                ds.add_where(col, EqualsOperator(), getattr(self.instance, name))
            self._execute(ds)
107580
def translate(root_list, use_bag_semantics=False):
    
    translator = (Translator() if use_bag_semantics else SetTranslator())
    return [translator.translate(root).to_sql() for root in root_list]
730496
def _delete(self, tree):
        
        tablename = tree.table
        table = self.describe(tablename, require=True)
        kwargs = {}
        visitor = Visitor(self.reserved_words)
        if tree.where:
            constraints = ConstraintExpression.from_where(tree.where)
            kwargs["condition"] = constraints.build(visitor)
        kwargs["expr_values"] = visitor.expression_values
        kwargs["alias"] = visitor.attribute_names
        return self._query_and_op(tree, table, "delete_item", kwargs)
1313926
def get_roots(self):
    
    if self.__directionless:
      sys.stderr.write("ERROR: can't get roots of an undirected graph\n")
      sys.exit()
    outputids = self.__nodes.keys()
    #print outputids
    rootset  = set(outputids) -  set(self.__child_to_parent.keys())
    return [self.__nodes[x] for x in rootset]
145198
def _extract_table_root(d, current, pc):
    
    logger_ts.info("enter extract_table_root")
    try:
        for k, v in d.items():
            if isinstance(v, str):
                current[pc + '_' + k] = v
    except Exception as e:
        logger_ts.error("extract_table_root: {}".format(e))
    return current
1126187
def columnCount(self, parent):
        
        if parent.isValid():
            return parent.internalPointer().column_count()
        else:
            return self._root.column_count()
939655
def _handle_usecols(self, columns, usecols_key):
        
        if self.usecols is not None:
            if callable(self.usecols):
                col_indices = _evaluate_usecols(self.usecols, usecols_key)
            elif any(isinstance(u, str) for u in self.usecols):
                if len(columns) > 1:
                    raise ValueError("If using multiple headers, usecols must "
                                     "be integers.")
                col_indices = []

                for col in self.usecols:
                    if isinstance(col, str):
                        try:
                            col_indices.append(usecols_key.index(col))
                        except ValueError:
                            _validate_usecols_names(self.usecols, usecols_key)
                    else:
                        col_indices.append(col)
            else:
                col_indices = self.usecols

            columns = [[n for i, n in enumerate(column) if i in col_indices]
                       for column in columns]
            self._col_indices = col_indices
        return columns
579944
def columnType( self ):
        
        schema = self.treeWidget().parent().schema()
        if ( not schema ):
            return 0
        column = schema.column(self.text(0))
        if ( column ):
            return column.columnType()
        return ColumnType.String
831574
def columns_used(self):
        
        return list(tz.unique(tz.concatv(
            self.choosers_columns_used(),
            self.alts_columns_used(),
            self.interaction_columns_used())))
96130
def find_roots( disconnected, index, shared ):
    
    log.warn( '%s disconnected objects in %s total objects', len(disconnected), len(index))
    natural_roots = [x for x in disconnected if x.get('refs') and not x.get('parents')]
    log.warn( '%s objects with no parents at all' ,len(natural_roots))
    for natural_root in natural_roots:
        recurse_module(
            natural_root, index, shared
        )
        yield natural_root
    rest = [x for x in disconnected if x.get( 'totsize' ) is None]
    un_found = {
        'type': 'module',
        'name': '<disconnected objects>',
        'children': rest,
        'parents': [ ],
        'size': 0,
        'totsize': sum([x['size'] for x in rest],0),
        'address': new_address( index ),
    }
    index[un_found['address']] = un_found
    yield un_found
603796
def _get_deleted_at_column(self, builder):
        
        if len(builder.get_query().joins) > 0:
            return builder.get_model().get_qualified_deleted_at_column()
        else:
            return builder.get_model().get_deleted_at_column()
712567
def columns(self):
        
        return Index(np.array(self._gather_column_names(), dtype=np.bytes_), np.dtype(np.bytes_))
1308140
def columns(self):
        
        c = self._connection.cursor()
        c.execute("describe `%s`.`%s`" % (self._db, self._name))
        self._cols = []
        for col in c.fetchall():
            self._cols.append(Column.build(col, table=self, con=self._connection))
        return self._cols
241309
def specifiedColumns(self):
        
        columns = []
        table = self.tableType()
        tree = self.treePopupWidget()
        schema = table.schema()
        
        if self._specifiedColumns is not None:
            colnames = self._specifiedColumns
        else:
            colnames = tree.columns()
        
        for colname in colnames:
            if isinstance(colname, Column):
                columns.append(colname)
            else:
                col = schema.column(colname)
                if col and not col.isProxy():
                    columns.append(col)
        
        return columns
942360
def root_sections(h):
    
    roots = []
    for section in h.allsec():
        sref = h.SectionRef(sec=section)
        # has_parent returns a float... cast to bool
        if sref.has_parent() < 0.9:
            roots.append(section)
    return roots