All Projects → coady → django-model-values

coady / django-model-values

Licence: other
Taking the O out of ORM.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to django-model-values

Open model zoo
Pre-trained Deep Learning models and demos (high quality and extremely fast)
Stars: ✭ 2,925 (+5031.58%)
Mutual labels:  models
FastNN
FastNN provides distributed training examples that use EPL.
Stars: ✭ 79 (+38.6%)
Mutual labels:  models
translatable
Add multilingual support to your laravel 5 models
Stars: ✭ 34 (-40.35%)
Mutual labels:  models
Django
The Web framework for perfectionists with deadlines.
Stars: ✭ 61,277 (+107403.51%)
Mutual labels:  models
TeslaKit
Elegant Tesla API in Swift
Stars: ✭ 47 (-17.54%)
Mutual labels:  models
mlx
Machine Learning eXchange (MLX). Data and AI Assets Catalog and Execution Engine
Stars: ✭ 132 (+131.58%)
Mutual labels:  models
Hydro Serving
MLOps Platform
Stars: ✭ 213 (+273.68%)
Mutual labels:  models
torchgeo
TorchGeo: datasets, samplers, transforms, and pre-trained models for geospatial data
Stars: ✭ 1,125 (+1873.68%)
Mutual labels:  models
MultiScaleArrays.jl
A framework for developing multi-scale arrays for use in scientific machine learning (SciML) simulations
Stars: ✭ 63 (+10.53%)
Mutual labels:  models
django-jsonfield-backport
Backport of the cross-DB JSONField model and form fields from Django 3.1.
Stars: ✭ 36 (-36.84%)
Mutual labels:  models
spacy-sentence-bert
Sentence transformers models for SpaCy
Stars: ✭ 88 (+54.39%)
Mutual labels:  models
slm-code-generation
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)
Stars: ✭ 75 (+31.58%)
Mutual labels:  models
DynamicalBilliards.jl
An easy-to-use, modular, extendable and absurdly fast Julia package for dynamical billiards in two dimensions.
Stars: ✭ 97 (+70.18%)
Mutual labels:  models
Django Colorfield
color field for django models with a nice color-picker in the admin. 🎨
Stars: ✭ 238 (+317.54%)
Mutual labels:  models
mlreef
The collaboration workspace for Machine Learning
Stars: ✭ 1,409 (+2371.93%)
Mutual labels:  models
Indicnlp catalog
A collaborative catalog of resources for Indian language NLP
Stars: ✭ 230 (+303.51%)
Mutual labels:  models
derivejs
DeriveJS is a reactive ODM - Object Document Mapper - framework, a "wrapper" around a database, that removes all the hassle of data-persistence by handling it transparently in the background, in a DRY manner.
Stars: ✭ 54 (-5.26%)
Mutual labels:  data-mapper
skutil
NOTE: skutil is now deprecated. See its sister project: https://github.com/tgsmith61591/skoot. Original description: A set of scikit-learn and h2o extension classes (as well as caret classes for python). See more here: https://tgsmith61591.github.io/skutil
Stars: ✭ 29 (-49.12%)
Mutual labels:  pandas
transformers-lightning
A collection of Models, Datasets, DataModules, Callbacks, Metrics, Losses and Loggers to better integrate pytorch-lightning with transformers.
Stars: ✭ 45 (-21.05%)
Mutual labels:  models
psyplot
Python package for interactive data visualization
Stars: ✭ 64 (+12.28%)
Mutual labels:  models

image image image image image image image image image image

Django model utilities for encouraging direct data access instead of unnecessary object overhead. Implemented through compatible method and operator extensions to QuerySets and Managers.

The goal is to provide elegant syntactic support for best practices in using Django's ORM. Specifically avoiding the inefficiencies and race conditions associated with always using objects.

Usage

Typical model usage is verbose, inefficient, and incorrect.

book = Book.objects.get(pk=pk)
book.rating = 5.0
book.save()

The correct method is generally supported, but arguably less readable.

Book.objects.filter(pk=pk).update(rating=5.0)

model_values encourages the better approach with operator support.

Book.objects[pk]['rating'] = 5.0

Similarly for queries:

(book.rating for book in books)
books.values_list('rating', flat=True)
books['rating']

Column-oriented syntax is common in panel data layers, and the greater expressiveness cascades. QuerySets also support aggregation and conditionals.

books.values_list('rating', flat=True).filter(rating__gt=0)
books['rating'] > 0

books.aggregate(models.Avg('rating'))['rating__avg']
books['rating'].mean()

Managers provide a variety of efficient primary key based utilities. To enable, instantiate the Manager in your models. As with any custom Manager, it doesn't have to be named objects, but it is designed to be a 100% compatible replacement.

from model_values import Manager

class Book(models.Model):
    ...
    objects = Manager()

F expressions are also enhanced, and can be used directly without model changes.

from model_values import F

.filter(rating__gt=0, last_modified__range=(start, end))
.filter(F.rating > 0, F.last_modified.range(start, end))

Installation

% pip install django-model-values

Tests

100% branch coverage.

% pytest [--cov]

Changes

1.5

  • Django >=3.2 required

1.4

  • Python >=3.7 required
  • Django 4 support

1.3

  • Django 3.2 support

1.2

  • Python >=3.6 required
  • Django >=2.2 required

1.1

  • Django 3 support

1.0

  • Update related methods moved with deprecation warnings
  • Extensible change detection and updates
  • Django 2.2 functions

0.6

  • Transform functions
  • Named tuples
  • Window functions
  • Distance lookups
  • Django 2.1 functions
  • EnumField
  • Annotated items
  • Expressions in column selection

0.5

  • F expressions operators any and all
  • Spatial lookups and functions
  • Django 2.0 support

0.4

  • upsert method
  • Django 1.9 database functions
  • bulk_update supports additional fields

0.3

  • Lookup methods and operators
  • F expressions and aggregation methods
  • Database functions
  • Conditional expressions for updates and annotations
  • Bulk updates and change detection

0.2

  • Change detection
  • Groupby functionality
  • Named tuples
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].