def __init__(self, query):
    if (query._statement is not None):
        if (isinstance(query._statement, expression.SelectBase) and (not query._statement._textual) and (not query._statement.use_labels)):
            self.statement = query._statement.apply_labels()
        else:
            self.statement = query._statement
    else:
        self.statement = None
        self.from_clause = query._from_obj
        self.whereclause = query._criterion
        self.order_by = query._order_by
    self.query = query
    self.session = query.session
    self.populate_existing = query._populate_existing
    self.invoke_all_eagers = query._invoke_all_eagers
    self.version_check = query._version_check
    self.refresh_state = query._refresh_state
    self.primary_columns = []
    self.secondary_columns = []
    self.eager_order_by = []
    self.eager_joins = {}
    self.create_eager_joins = []
    self.propagate_options = set((o for o in query._with_options if o.propagate_to_loaders))
    self.attributes = query._attributes.copy()
def __init__(self, query):
    if (query._statement is not None):
        if (isinstance(query._statement, expression.SelectBase) and (not query._statement._textual) and (not query._statement.use_labels)):
            self.statement = query._statement.apply_labels()
        else:
            self.statement = query._statement
    else:
        self.statement = None
        self.from_clause = query._from_obj
        self.whereclause = query._criterion
        self.order_by = query._order_by
    self.query = query
    self.session = query.session
    self.populate_existing = query._populate_existing
    self.invoke_all_eagers = query._invoke_all_eagers
    self.version_check = query._version_check
    self.refresh_state = query._refresh_state
    self.primary_columns = []
    self.secondary_columns = []
    self.eager_order_by = []
    self.eager_joins = {}
    self.create_eager_joins = []
    self.propagate_options = set((o for o in query._with_options if o.propagate_to_loaders))
    self.attributes = query._attributes.copy()