Skip to content

Releases: dymmond/edgy

Version 0.17.0

30 Sep 03:25
80f019c
Compare
Choose a tag to compare

Added

  • Support for querying across multiple databases.
  • Support for passing functions as clauses or keyword parameters.
  • Support for autocreated reflection objects by pattern matching.
  • Added some context variables for extract_column_values and transform_input:
    • CURRENT_PHASE: allows retrieving the current context in which it was executed.
    • EXPLICIT_SPECIFIED_VALUES: when set, it returns a set of the keys from the explicitly specified values.

Changed

  • crawl_relationship has a slightly changed interface: it has cross_db_remainder as kwarg for callbacks and in the result.
    Also it doesn't raise NotImplementedError anymore when detecting a crossdb situation.
  • is_cross_db optionally gets a database as parameter and compares the databases instead of registries.
  • Relax fields parameter requirements for values/values_list.
  • More lazy meta/metadata.
  • database attribute of models is used for queries instead of the main database of the registry.
  • We use more metaclass kwarg arguments.
  • Switch to python >= 3.9.
  • Rename internal _is_init of MetaInfo to _fields_are_initialized.
  • phase argument is shifted to CURRENT_PHASE context_var. If you rely on the correct phase you need to use it instead.
  • extract_column_values provides now also a CURRENT_PHASE environment.
  • is_update argument of get_defaults is now replaced by CURRENT_PHASE too. It is way more accurate.
  • Deprecate force_save kwarg of save in favor of force_insert. This is way more precise.
  • post_save_callback receives now also the force_insert parameter.

Fixed

  • Fix ForeignKey not None but empty hull under some conditions.
  • Fix DecimalField requiring max_digits.

Version 0.16.0

19 Sep 17:35
339808e
Compare
Choose a tag to compare

Added

  • ASGI, async context manager support to connect/disconnect multiple dbs at once.
  • create_all/drop_all, create_schema/drop_schema are now capable of initializing dbs in extra.
  • Add transaction helper to Model and QuerySet.
  • Allow copying models properly.
  • Allow None as default.

Changed

  • Unify using to allow setting schema and database via keyword arguments and deprecate both former calls.

Fixed

  • Esmerald typing issues.
  • Migration metadata was not completely initialized which caused problems.
  • Foreign keys None/null handling was inconsistent. Now we have a None for unset foreign keys.

Version 0.15.0

14 Sep 09:35
58539a3
Compare
Choose a tag to compare

Added

  • FileField and File handling.
  • ImageField stub (more is comming soon)
  • stage method in relations.
  • ModelRefs passed as normal positional arguments are automatically staged.
  • ContentType was added.
  • Proper callback support was added.
  • remove_referenced parameter for ForeignKeys was added.
  • Virtual CASCADE deletion is now used for ForeignKeys without constraint.

Changed

  • Breaking: ModelReferences use now the related name instead of the model name.
  • Breaking: Field Factories pass now keyword arguments as positional dictionary. This way keyword arguments manipulations in validate are possible.
    This way it can be distinguished between multiple foreign keys to the same model and self-references are possible.
  • model_references are superseeded by post_save_fields in meta.
  • ModelParser mixin is gone. Use the classmethod extract_column_values instead.
  • edgy_settr is not used internally anymore (circular imports).
  • modify_input receives now an argument phase.
  • foreign_key_fields is now a frozenset.
  • Switch away from nest_asyncio.
  • All sqlalchemy operators are now accessable. The setting for them is gone.

Fixed

  • Factory overwrites can now access owner.
  • Foreign keys to reflected models.
  • Handling to string references not in registry loaded yet.
  • Timezone aware Datetime saved in timezone unaware database columns.

Version 0.14.1

21 Aug 10:17
5682e9d
Compare
Choose a tag to compare

Changed

  • Bump dependency of databasez.

Fixed

  • Fix load_recursive.

Version 0.14.0

20 Aug 06:23
de77d4c
Compare
Choose a tag to compare

Added

  • Cache per queryset.
  • Expose raw_query for getting a raw sqlalchemy query.
  • Expose control for used batch size.
  • Add load_recursive for initializing a nested model structure.

Changed

  • Server defaults don't trigger load after saving.
  • Less nested run_sync calls.
  • Alter queryset methods to contain useful arguments, instead of ignoring kwargs.
  • Replace QuerysetProtocol by abstract base type.

Fixed

  • get_or_none was not abidding embed_parent.
  • Correctly apply filters on relations.
  • last and first don't fail without id column anymore.

Version 0.13.1

13 Aug 08:16
aa70ea3
Compare
Choose a tag to compare

Added

  • Testclient can be configured via environment variables.

Fixed

  • Compatibility with newer databasez releases (>0.9).

Version 0.13.0

07 Aug 16:40
aa74c71
Compare
Choose a tag to compare

Added

  • default_timezone, force_timezone, remove_timezone for DateTimeField.
  • default_timezone, force_timezone for DateField.
  • Add attribute inject_default_on_partial_update.
  • Allow factories overwriting field methods.
  • Deep embedding via embed_parent possible.
  • Support for nearly all async sqlalchemy drivers plus more from databasez.

Changed

  • get_default_values has now an extra keyword argument is_update
  • meta.fields_mapping was renamed to meta.fields.-
  • Factories have now different named configuration variables.
  • Refactoring of fields and models:
    • BaseModelType and BaseFieldType are now added and should be used for typings.
    • get_column works now via extractor.
    • Renamed internals.
    • Splitted model_references and column values extraction.
  • Comparisons of models use now only primary keys.
  • Deprecate on model forwards signals, fields. Use now meta.signals, meta.fields.

Removed

  • execsync (nearly no uses).
  • DateParser mixin (superseeded by sqlalchemy's logic).

Fixed

  • auto_now and auto_now_add now also work for date fields.
  • BinaryField had a wrong type.
  • Metaclasses with keyword arguments are now possible.
  • Relaxed Prefetching, tables can now appear multiple times.
  • select_related now correctly filters columns.

Version 0.12.0

28 Jun 13:58
8fc8c33
Compare
Choose a tag to compare

Added

  • Allow multiple ForeignKeys with the same related_name in one model.
  • Support ForeignKeys on multiple columns.
  • Allow selecting columns for ForeignKeys.
  • Allow skipping creating a ForeignKeyConstraint.
  • Add ExcludeField for masking fields in submodels.
  • ManyToMany fields pass unique through to target foreignkey.
  • Add ConditionalRedirect constant for CompositeField.
  • Embeddables via CompositeField. See Embedding
  • Add ForeignKeyFactory, a factory with presets for building foreign keys.
  • Multiple primary keys and names different from "id" are possible now.
  • Add inherit flag for Manager, BaseFields and Models (when used as an embeddable). It is used for controlling the inheritance.
  • Managers are now instance aware. You can customize the instance and they can react. They are also shallow copied for every class and instance.
  • Improved Relations (reverse side of ForeignKeys and forward side of Many2Many). Have now add and remove methods and work like RefForeignKey (you can just specify an Array with assignment targets and they will be added).
  • Allow skip building reverse RelatedFields for ForeignKeys with related_name=False.
  • pkcolumns attribute of models (contains all found primary key columns).
  • Some new methods on BaseField:
    • embed_field: for controlling embedding a field in an CompositeField.
    • get_column_names: helper function for retrieving the column names of a field.
  • Add RelationshipField for traversable fields.

Changed

  • ForeignKeys use now global constraints and indexes.
  • Breaking: clean has now the argument to_query. See Custom Fields.
  • Breaking: ManyToMany doesn't have a RelatedField on owner anymore and uses proxying. See ManyToMany.
  • Breaking: use singular related_name for unique ForeignKeys (or OneToOne). See related_name
  • MetaInfo (meta) is now partly lazy.
  • pk is now a PKField (a variant of the BaseCompositeField).
  • clean and to_columns of BaseField do return empty objects instead of raising NotImplementedError.
  • Major refactory of ForeignKeys, move logic for single ForeignKeys to subclass.
  • Move FieldFactory and ForeignKeyFieldFactory to factories.
  • Remove superfluous BaseOneToOneKeyField. Merged into BaseForeignKeyField.
  • Remove unused attributes of MetaInfo and added some lazy evaluations for fields.

Breaking

  • Prefetch traversal of foreign keys uses now the foreign key name. For the traversal of RelatedFields everything stays the same.

What's Changed

Full Changelog: 0.11.1...0.12.0

Version 0.11.1

23 May 10:12
acf009e
Compare
Choose a tag to compare

Added

  • create_schema allowing a dynamic and programatically
    way of creating schemas in the database.

Changed

  • Updated reflection from edgy.ReflectModel to use the internal database session and avoid
    deadlocks.
  • Internal cleaning for tenancy.

Version 0.11.0

22 May 11:18
24097b7
Compare
Choose a tag to compare

Added

  • Support for Marshall allowing custom serialization of an Edgy model by @tarsil.
  • Support for the new CompositeField enhancing the ability of
    having multiple primary keys (or composed keys) in an Edgy model by @devkral.
  • Support for the Q queryset clause by @devkral.

Changed

  • Cleaned up FieldFactory internals by @devkral.
  • pyproject.toml definitions by @devkral.
  • Internal Edgy model_dump covering internals of Edgy and corner cases of Pydantic for compatibility reasons by @devkral.

Fixed

  • Typos in is_primary key attribute by @devkral.
  • InspectDB when provided with a schema name was not using it in the registry.