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

Is "datetime minus datetime" not implemented in PonyORM? #438

Closed
Elijas opened this issue Mar 22, 2019 · 1 comment
Closed

Is "datetime minus datetime" not implemented in PonyORM? #438

Elijas opened this issue Mar 22, 2019 · 1 comment

Comments

@Elijas
Copy link

Elijas commented Mar 22, 2019

exc_type = <class 'TypeError'>
args = ("Unsupported operand types 'datetime' and 'datetime' for operation '-' in expression: {EXPR}",)
kwargs = {}

    def throw(exc_type, *args, **kwargs):
        if isinstance(exc_type, Exception):
            assert not args and not kwargs
            exc = exc_type
        else: exc = exc_type(*args, **kwargs)
        exc.__cause__ = None
        try:
            if not (pony.MODE == 'INTERACTIVE' and options.CUT_TRACEBACK):
>               raise exc
E               TypeError: Unsupported operand types 'datetime' and 'datetime' for operation '-' in expression: datetime.utcnow() - car.created_at

pony 0.7.9

@kozlovsky
Copy link
Member

Thanks for reporting, should work in 0.7.11

kozlovsky added a commit that referenced this issue Oct 23, 2019
# Features

* #472: Python 3.8 support
* Support of hybrid functions (inlining simple Python functions into query)
* #438: support datetime-datetime, datetime-timedelta, datetime+timedelta in queries

# Bugfixes

* #430: add ON DELETE CASCADE for many-to-many relationships
* #465: Should reconnect to MySQL on OperationalError 2013 'Lost connection to MySQL server during query'
* #468: Tuple-value comparisons generate incorrect queries
* #470 fix PendingDeprecationWarning of imp module
* Fix incorrect unpickling of objects with Json attributes
* Check value of discriminator column on object creation if set explicitly
* Correctly handle Flask current_user proxy when adding new items to collections
* Some bugs in syntax of aggregated queries were fixed
* Fix syntax of bulk delete queries
* Bulk delete queries should clear query results cache so next select will get correct result from the database
* Fix error message when hybrid method is too complex to decompile
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

No branches or pull requests

2 participants