Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

DateTime fractions of seconds are lost #42

Open
PhilippJust opened this issue Aug 15, 2019 · 0 comments
Open

DateTime fractions of seconds are lost #42

PhilippJust opened this issue Aug 15, 2019 · 0 comments

Comments

@PhilippJust
Copy link

Expected Behavior

  • When inserting an entity with DateTime properties to a table, I expect the stored value to have the same precision as the property of the entity

Actual Behavior

  • Fractions of seconds are only present for the standard Timestamp column but lost for custom properties.
    See this screenshot taken with the azure storage explorer
    grafik

Proposed solution

The transformation is defined in the azure storage common project in line 46 of _serialization.py.

def _to_utc_datetime(value):
    # Azure expects the date value passed in to be UTC.
    # Azure will always return values as UTC.
    # If a date is passed in without timezone info, it is assumed to be UTC.
    if value.tzinfo:
        value = value.astimezone(tzutc())
    return value.strftime('%Y-%m-%dT%H:%M:%SZ')

It is seen that this function always ignores everything smaller than a second. So therefor I propose to change this line to include milliseconds as well.

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

No branches or pull requests

1 participant