Skip to content

Version 0.37.0

Latest

Choose a tag to compare

@devkral devkral released this 26 Sep 09:52
· 1 commit to main since this release
0.37.0
b677074

Added

  • Add different anchor points for prefetches which allows prefetching across databases.
  • Allow sub-attributes (select_related) for prefetches as anchor.
  • Allow chaining to_attr to anchor by prefixing with +.
  • crawl_relationship has now a mode to traverse databases.
  • Add replace keyword to extra_select.

Changed

  • crawl_relationship returns now not exact as operator, when no operator was found but an empty string.
  • Make Fields, FieldToColumns, FieldToColumnNames and ColumnsRemapping appropriate mappings.
    You can't do the dirty trick anymore testing for a dict.
  • Fix contracts; it was always an error to access the data attribute directly (just inherited from UserDict).
  • from_sqla_row is keyword only now, so we can better update and introspect it.
  • Make Prefetch's init_bake and other internals private. QuerySetErrors are now raised if the attributes are illegally accessed.
  • Make Prefetch keyword-only like in documentation.
  • Assign prefetches from queryset not in from_sqla_row. This allows better handling of embeddings.
  • create_model_key_from_sqla_row is deprecated now. Use the more generalized create_model_key_from_raw_mapping for the row mapping (row._mapping) instead.
  • Move get_table_key_or_name to edgy.core.utils.db.
  • Add the embedded path of the source database implicitly to select_related paths.
  • crawl_relationship has now a better error when a field does not exist.
  • Unpacking and accessing CrawlResult (the result of crawl_relationship) is now deprecated. Use the results attributes instead.
  • select_related has now a sparse mode, which will become the default in future. It doesn't select all columns on the intermediate paths but only the ones required for traversal.
  • Unpacking RelationshipCrawlResult like a tuple is deprecated now. Access attributes directly.
  • Make embed_parent and embed_parent_filters internal (prefixed with _).
  • Identity checks may need an update when doing the check on a non-selected path (e.g. implicitly added paths for prefetches).
    Replace idioms isinstance(user, User) with user.get_real_class() is User for maximal compatibility.
  • Deprecate setting attributes on QuerySet via keywords (except model_class and using_schema).
  • Deprecate passing model_class to QuerySet as positional argument. Use keywords instead.
  • Calling only without arguments, reset the selected fields instead of setting them to pknames and pkcolumns.
    This behavior matches the one of defer.

Fixed

  • ForeignKeys on unique columns became incorrectly unique.
  • Using create on non-nullable ForeignKey relations.
  • Don't mask AttributeErrors in managers when creating the queryset failed.
  • to_attr and from_anchor of Prefetch doesn't require explicit select_related calls anymore. They are deduced.
  • Performance issues with update_embed_parent when not using select_related. Also implicit deduced.
  • Direct bulk and other create operations on relations.
    Note: The create operation stays special for relations.
  • Fix comparation between databases in CombinedQuerySet. Remove non-existing attributes and compare properly the urls.

Removed

  • Remove long deprecated fields and fields_mapping attributes of models.
  • Remove long deprecated only_fields, defer_fields, distinct_on, limit_count, limit_offset kwargs from QuerySet __init__.
  • Remove only, defer, embed_parent, select_related from QuerySet __init__. They need internal cleanup logic which shouldn't be called in __init__ and may end in loops.

Breaking

  • crawl_relationship returns now not exact as operator, when no operator was found but an empty string.
  • select_related intermediate paths will not be fully selected anymore by default in future.
    In the new sparse mode only the relevant columns for traversing are selected, while columns selected via embed_parent
    and models loaded with select_related are fully selected. It will become the default in future.
    A DeprecationWarning will be issued if you are affected.
    Upgrade select_related("company__user") to select_related("company","company__user") or use the keyword sparse=False.
  • When querying selected instances are proxy models and may not contain every value (except when selected). This disallows checks like isinstance(user, User). Replace it with user.get_real_class() is User.
  • Remove only, defer, embed_parent, select_related from QuerySet __init__ as well as some long deprecated aliases.