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

[FEATURE] Support human-readable dates for database rollbacks #78

Open
Markus00000 opened this issue Apr 23, 2024 · 1 comment
Open

Comments

@Markus00000
Copy link

Is your feature request related to a problem? Please describe.

--rollback-database uses Unix timestamps, which can be inconvenient to obtain and are hard to comprehend for humans.

Describe the solution you'd like.

--rollback-database could support human-readable dates (e.g. in ISO format):

>>> import datetime
>>> d = datetime.datetime.fromisoformat('2024-04-23T14:26:40+02:00')
>>> d.replace(tzinfo=datetime.timezone.utc).timestamp()

Or using dateutil (examples):

>>> from dateutil import parser
>>> d = parser.parse('2024-04-23T14:39:38 CEST')
>>> d.replace(tzinfo=datetime.timezone.utc).timestamp()

dateutil accepts many inputs and is already installed as a dependency on my system for several applications. However, I am skeptical that an additional dependency is warranted considering how rarely most users will roll back their database. I would be happy with just datetime.datetime.fromisoformat.

In short:

--rollback-database ISO_DATE
--rollback-database TIMESTAMP
@mborsetti
Copy link
Owner

Makes sense, thanks for taking the time to make the suggestion!

Can structure it so that dateutil is used unless it's not found on the system, in which case it it falls back to using datetime (so there's no formal dependency on dateutil.

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