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

bug: Datetime fields break DynamoDB serialization for models #17

Closed
timoguin opened this issue Dec 10, 2021 · 0 comments · Fixed by #21
Closed

bug: Datetime fields break DynamoDB serialization for models #17

timoguin opened this issue Dec 10, 2021 · 0 comments · Fixed by #21
Assignees
Labels
bug Something isn't working

Comments

@timoguin
Copy link
Owner

The DynamoDB serializer implemented in ModelBase().to_dynamodb() fails with a TypeError if there is a datetime.datetime field on the model instance.

This is breaking the organization.Account model serialization. In the previous release, the joined_timestamp field was a string type instead of datetime.datetime.

Error message:

TypeError: Unsupported type "<class 'datetime.datetime'>" for value "2021-07-07 13:50:04.829000-05:00"
@timoguin timoguin added the bug Something isn't working label Dec 10, 2021
@timoguin timoguin self-assigned this Dec 10, 2021
timoguin added a commit that referenced this issue Jan 26, 2022
…ation

This fixes a few bugs with organizations models, as well as one with ModelBase.

### Changed

- Changed the `Account.joined_timestamp` field from datetime to str to fix DynamoDB (de)serialization
- Changed the `Organization` model to allow fields to be null for empty init
- Fixes broken login in `ModelBase.to_dict()` when passing field_name, removes unused flatten kwarg

Closes #17
timoguin added a commit that referenced this issue Jan 26, 2022
…ation (#21)

This fixes a few bugs with organizations models, as well as one with ModelBase.

### Changed

- Changed the `Account.joined_timestamp` field from datetime to str to fix DynamoDB (de)serialization
- Changed the `Organization` model to allow fields to be null for empty init
- Fixes broken login in `ModelBase.to_dict()` when passing field_name, removes unused flatten kwarg

Closes #17
timoguin added a commit that referenced this issue Jan 28, 2022
In attempting to fix DynamoDB serialization for the `Account` model in #17, another bug
was introduced. This fixes it.

### Changed

- Adds configuration to `Account.from_dict()` to cast `joined_timestamp` to a string
timoguin added a commit that referenced this issue Jan 28, 2022
In attempting to fix DynamoDB serialization for the `Account` model in #17, another bug
was introduced. This fixes it.

### Changed

- Adds configuration to `Account.from_dict()` to cast `joined_timestamp` to a string
- Updates `ModelBase.from_dict()` to accept and pass through kwargs
timoguin added a commit that referenced this issue Jan 28, 2022
In attempting to fix DynamoDB serialization for the `Account` model in #17, another bug
was introduced. This fixes it.

### Changed

- Adds configuration to `Account.from_dict()` to cast `joined_timestamp` to a string
- Updates `ModelBase.from_dict()` to accept and pass through kwargs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant