Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple aggregates and TZ error fixed #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mpcabd
Copy link

@mpcabd mpcabd commented Jun 26, 2013

  • Added multiple aggregates in one query.
  • Fixed TZ error.

@kmike
Copy link
Collaborator

kmike commented Jun 29, 2013

Hi @mpcabd,

I think that your changes are a good idea performance-wise, but IMHO the API becomes significally worse for simple cases. What do you think about returning lists only when a list of aggregates are passed (this is usually a bad idea though), or to provide an another class (e.g. MultiQuerySetStats) that returns lists and accepts lists?

About TZ changes: there is a ticket for it ( https://bitbucket.org/kmike/django-qsstats-magic/issue/6/zero-data-with-django-14-use_tz-true ), but I wasn't able to reproduce it while ago. Could you please provide a test case that demonstrates the issue?

Thanks!

@mpcabd
Copy link
Author

mpcabd commented Jun 29, 2013

Hi @kmike,

In this commit @3bc1d66 I made the class return the results in the same tuple, so instead of always returning a list the class now returns the data within the same tuple. But I agree that may be a MultiQuerySetStats class would be a better solution. I will do it that way and push it to my fork.

As for the TZ issue, you need to try and create a Django application where USE_TZ = True and any time zone that's not UTC for example in my case TIME_ZONE = 'Asia/Dubai' which is UTC+4, then all your queries will return 0 values because of the TZ difference between the code and the DB since Django saves the data in the DB in UTC timezone while python will be using UTC+4.

Thanks.

@PetrDlouhy
Copy link
Owner

@mpcabd Could you please update this? Rebase to the master (which should trigger Travis tests), apply the MultiQuerySetStats solution and make automated test for the TZ error fix?

I would also prefer, if this is split into two separate PRs (as I understand, these are two separate problems).

Please, don't change the repository URL in setup.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants