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

Change: Message.time was float, becomes datetime #40

Merged
merged 6 commits into from
Nov 25, 2023

Conversation

hoh
Copy link
Member

@hoh hoh commented Jan 27, 2023

Change the type if BaseMessage.time to a datetime. This allows easier manipulation of the field, and parsing from strings as well as floats.

New APIs introduced in PyAleph 0.5.0 store the message time as timestampz and return it as ISO strings. This changes is compatible with both the old and new APIs.

@hoh hoh requested review from odesenfans and BjrInt January 27, 2023 19:21
Copy link
Member

@BjrInt BjrInt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but:
Shouldn't the pydantic model also explicitly include Float for clarity?

@hoh
Copy link
Member Author

hoh commented Feb 9, 2023

This would send datetimes as strings, which is likely not compatible with the MongoDB API - we should wait for the PostgreSQL based version of PyAleph to release this.

@hoh hoh marked this pull request as draft March 2, 2023 10:51
@hoh
Copy link
Member Author

hoh commented Mar 2, 2023

Moved as draft, all nodes should be upgraded to use Postgres beforehand.

@hoh hoh added the question Further information is requested label May 22, 2023
@MHHukiewitz
Copy link
Member

Moved as draft, all nodes should be upgraded to use Postgres beforehand.

Nodes are using Postgres now, should we continue pursing this PR?

@hoh
Copy link
Member Author

hoh commented Nov 23, 2023

Add a @validator to convert float to datetime

@MHHukiewitz
Copy link
Member

@hoh it's ready

@MHHukiewitz MHHukiewitz marked this pull request as ready for review November 24, 2023 11:08
hoh and others added 4 commits November 24, 2023 12:16
Change the type if BaseMessage.time to a datetime. This allows easier manipulation of the field, and parsing from strings as well as floats.

New APIs introduced in PyAleph 0.5.0 store the message time as timestampz and return it as ISO strings. This changes is compatible with both the old and new APIs.
aleph_message/models/__init__.py Outdated Show resolved Hide resolved
@MHHukiewitz MHHukiewitz merged commit d297d88 into main Nov 25, 2023
2 checks passed
@MHHukiewitz MHHukiewitz deleted the hoh-time-datetime branch November 25, 2023 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants