django-aggregates
=================
Aggregate, String and Conditional SQL functions to use into Annotate and Aggregate methods. Any kind of contribitions and ideas are welcome.
Installation
=================
pip install django-aggregates
Usage
=================
>> from aggregates import StringAgg
>> People.objects.aggregate(names=StringAgg('name', delimiter(', ')))
>> {'names': 'Walter, The Dude, Donny, Jesus'}
>> from aggregates import As
>> People.objects.values('address__title').annotate(prettyname=As('address__title')).values('prettyname')
>> [{'prettyname': 'someadress1'}, {'prettyname': 'someaddress2'}]
>> from aggregates.strings import CharLength
>> People.objects.annotate(char_len=CharLength('name')).filter(char_len__gt=6)
>> [<People: Walter>, <People: The Dude>]
>> from aggregates.conditionals import Coalesce, NullIf
>> person=People.objects.annotate(null_if=NullIf('name', othercol='surname'))[0]
>> person.null_if
>> 'Walter'
>> person=People.objects.annotate(coalesce=Coalesce('age', default=18))[0]
>> person.coalesce
>> 18
>> person.age
>>
Available Functions
=================
Aggregates:
from aggregates import ...
- As
- BitAnd
- BitOr
- BoolAnd **# Only PostgreSQL**
- BoolOr **# Only PostgreSQL**
- Every **# Only PostgreSQL**
- StringAgg **# Only PostgreSQL**
- XMLAgg **# Only PostgreSQL**
- Corr **# Only PostgreSQL**
- CovarPop **# Only PostgreSQL**
- CovarSamp **# Only PostgreSQL**
- RegrAvgX **# Only PostgreSQL**
- RegrAvgY **# Only PostgreSQL**
- RegrCount **# Only PostgreSQL**
- RegrIntercept **# Only PostgreSQL**
- RegrR2 **# Only PostgreSQL**
- RegrSlope **# Only PostgreSQL**
- RegrSXX **# Only PostgreSQL**
- RegrSXY **# Only PostgreSQL**
- RegrSYY **# Only PostgreSQL**
- Mode **# Only PostgreSQL 9.4+**
- PercentileCont **# Only PostgreSQL 9.4+**
- PercentileDisc **# Only PostgreSQL 9.4+**
Strings:
from aggregates.string import ...
- BitLength
- CharLength
- CharacterLength
- OctetLength
- Lower
- Upper
- Ascii
- Length
- MD5 **# Only PostgreSQL**
Conditionals:
from aggregates.conditionals import ...
- NullIf
- Coalesce **# Only PostgreSQL**
Requirements
==================================
- Django 1.2+
TODO
=================
- UnitTests.
- More detailed informations about functions.
- JSON functions and operations
Raw data
{
"_id": null,
"home_page": "https://github.com/aykut/django-aggregates",
"name": "django-aggregates",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Aykut Ozat",
"author_email": "aykutozat@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2a/40/dcf66841f61bbc00fb74e3bec831653fef03819ffee37ad9e05358fd3684/django-aggregates-0.1.3.tar.gz",
"platform": "UNKNOWN",
"description": "django-aggregates\n=================\nAggregate, String and Conditional SQL functions to use into Annotate and Aggregate methods. Any kind of contribitions and ideas are welcome.\n\nInstallation\n=================\n pip install django-aggregates\n\nUsage\n=================\n >> from aggregates import StringAgg\n >> People.objects.aggregate(names=StringAgg('name', delimiter(', ')))\n >> {'names': 'Walter, The Dude, Donny, Jesus'}\n\n >> from aggregates import As\n >> People.objects.values('address__title').annotate(prettyname=As('address__title')).values('prettyname')\n >> [{'prettyname': 'someadress1'}, {'prettyname': 'someaddress2'}]\n\n >> from aggregates.strings import CharLength\n >> People.objects.annotate(char_len=CharLength('name')).filter(char_len__gt=6)\n >> [<People: Walter>, <People: The Dude>]\n\n >> from aggregates.conditionals import Coalesce, NullIf\n >> person=People.objects.annotate(null_if=NullIf('name', othercol='surname'))[0]\n >> person.null_if\n >> 'Walter'\n >> person=People.objects.annotate(coalesce=Coalesce('age', default=18))[0]\n >> person.coalesce\n >> 18\n >> person.age\n >>\n\nAvailable Functions\n=================\nAggregates:\n\n from aggregates import ...\n- As\n- BitAnd\n- BitOr\n- BoolAnd **# Only PostgreSQL**\n- BoolOr **# Only PostgreSQL**\n- Every **# Only PostgreSQL**\n- StringAgg **# Only PostgreSQL**\n- XMLAgg **# Only PostgreSQL**\n- Corr **# Only PostgreSQL**\n- CovarPop **# Only PostgreSQL**\n- CovarSamp **# Only PostgreSQL**\n- RegrAvgX **# Only PostgreSQL**\n- RegrAvgY **# Only PostgreSQL**\n- RegrCount **# Only PostgreSQL**\n- RegrIntercept **# Only PostgreSQL**\n- RegrR2 **# Only PostgreSQL**\n- RegrSlope **# Only PostgreSQL**\n- RegrSXX **# Only PostgreSQL**\n- RegrSXY **# Only PostgreSQL**\n- RegrSYY **# Only PostgreSQL**\n- Mode **# Only PostgreSQL 9.4+**\n- PercentileCont **# Only PostgreSQL 9.4+**\n- PercentileDisc **# Only PostgreSQL 9.4+**\n\nStrings:\n\n from aggregates.string import ...\n- BitLength\n- CharLength\n- CharacterLength\n- OctetLength\n- Lower\n- Upper\n- Ascii\n- Length\n- MD5 **# Only PostgreSQL**\n\nConditionals:\n\n from aggregates.conditionals import ...\n- NullIf\n- Coalesce **# Only PostgreSQL**\n\nRequirements\n==================================\n- Django 1.2+\n\nTODO\n=================\n- UnitTests.\n- More detailed informations about functions.\n- JSON functions and operations",
"bugtrack_url": null,
"license": "UNKNOWN",
"summary": "Aggregate, String and Conditional SQL functions for Django ORM.",
"version": "0.1.3",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/aykut/django-aggregates"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d3b0a14e92677083515db41ec388231bdb87f4fc4bdfa665c7d69745d02b1743",
"md5": "3c2e7e31b4a4caf580de61ed39f628c0",
"sha256": "8b89324c7b5bf0c3133cda209be4d77fe299f1f254ef71f8ef9ee641c4f4403e"
},
"downloads": -1,
"filename": "django_aggregates-0.1.3-py2-none-any.whl",
"has_sig": false,
"md5_digest": "3c2e7e31b4a4caf580de61ed39f628c0",
"packagetype": "bdist_wheel",
"python_version": "2.7",
"requires_python": null,
"size": 8463,
"upload_time": "2016-09-21T19:14:17",
"upload_time_iso_8601": "2016-09-21T19:14:17.785140Z",
"url": "https://files.pythonhosted.org/packages/d3/b0/a14e92677083515db41ec388231bdb87f4fc4bdfa665c7d69745d02b1743/django_aggregates-0.1.3-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2a40dcf66841f61bbc00fb74e3bec831653fef03819ffee37ad9e05358fd3684",
"md5": "cb92ea59c0d87b4325d8f4c643558145",
"sha256": "9daf619caca866ef5c84b0216f59f929341efbb18b7dbe748f376efb0cad53a7"
},
"downloads": -1,
"filename": "django-aggregates-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "cb92ea59c0d87b4325d8f4c643558145",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4183,
"upload_time": "2016-09-21T19:12:54",
"upload_time_iso_8601": "2016-09-21T19:12:54.878693Z",
"url": "https://files.pythonhosted.org/packages/2a/40/dcf66841f61bbc00fb74e3bec831653fef03819ffee37ad9e05358fd3684/django-aggregates-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2016-09-21 19:12:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aykut",
"github_project": "django-aggregates",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-aggregates"
}