Closed bruth closed 9 years ago
Specifically, these lines: https://github.com/chop-dbhi/avocado/blob/master/avocado/core/cache/model.py#L18-L19
To reproduce:
>>> qs = Cohort.objects.all() >>> qs.query.__getstate__() {'_aggregate_select_cache': None, '_extra_select_cache': None, 'aggregate_select_mask': None, 'aggregates': {}, 'alias_map': {}, 'alias_refcount': {}, 'default_cols': True, 'default_ordering': True, 'deferred_loading': (set(), True), 'distinct': False, 'distinct_fields': [], 'dupe_avoidance': {}, 'extra': {}, 'extra_order_by': (), 'extra_select_mask': None, 'extra_tables': (), 'filter_is_sticky': False, 'group_by': None, 'having': <django.db.models.sql.where.WhereNode at 0x10467ecd0>, 'high_mark': None, 'included_inherited_models': {}, 'join_map': {}, 'low_mark': 0, 'max_depth': 5, 'model': audgendb.production.models.Cohort, 'order_by': [], 'ordering_aliases': [], 'related_select_cols': [], 'related_select_fields': [], 'select': [], 'select_fields': [], 'select_for_update': False, 'select_for_update_nowait': False, 'select_related': False, 'standard_ordering': True, 'table_map': {}, 'tables': [], 'used_aliases': set(), 'where': <django.db.models.sql.where.WhereNode at 0x10467ec50>, 'where_class': django.db.models.sql.where.WhereNode} # Does not execute the query.. but lazily populates more state.. >>> str(qs.query) SELECT "production_cohort"."id", "production_cohort"."count", "production_cohort"."created", "production_cohort"."modified", "production_cohort"."name", "production_cohort"."user_id", "production_cohort"."context_json" FROM "production_cohort" >>> qs.query.__getstate__() {'_aggregate_select_cache': None, '_extra_select_cache': None, 'aggregate_select_mask': None, 'aggregates': {}, 'alias_map': {u'production_cohort': JoinInfo(table_name=u'production_cohort', rhs_alias=u'production_cohort', join_type=None, lhs_alias=None, lhs_join_col=None, rhs_join_col=None, nullable=False)}, 'alias_refcount': {u'production_cohort': 1}, 'default_cols': True, 'default_ordering': True, 'deferred_loading': (set(), True), 'distinct': False, 'distinct_fields': [], 'dupe_avoidance': {}, 'extra': {}, 'extra_order_by': (), 'extra_select_mask': None, 'extra_tables': (), 'filter_is_sticky': False, 'group_by': None, 'having': <django.db.models.sql.where.WhereNode at 0x10467ecd0>, 'high_mark': None, 'included_inherited_models': {None: u'production_cohort'}, 'join_map': {(None, u'production_cohort', None, None): (u'production_cohort',)}, 'low_mark': 0, 'max_depth': 5, 'model': audgendb.production.models.Cohort, 'order_by': [], 'ordering_aliases': [], 'related_select_cols': [], 'related_select_fields': [], 'select': [], 'select_fields': [], 'select_for_update': False, 'select_for_update_nowait': False, 'select_related': False, 'standard_ordering': True, 'table_map': {u'production_cohort': [u'production_cohort']}, 'tables': [u'production_cohort'], 'used_aliases': set(), 'where': <django.db.models.sql.where.WhereNode at 0x10467ec50>, 'where_class': django.db.models.sql.where.WhereNode}
It appears initializing a compiler and doing some operation populates the remaining state of the query object.
Specifically, these lines: https://github.com/chop-dbhi/avocado/blob/master/avocado/core/cache/model.py#L18-L19
To reproduce:
It appears initializing a compiler and doing some operation populates the remaining state of the query object.