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

Timestamp Calculation doesn't work in Windows #283

Open
squintsgeek opened this issue Aug 24, 2022 · 3 comments
Open

Timestamp Calculation doesn't work in Windows #283

squintsgeek opened this issue Aug 24, 2022 · 3 comments
Labels

Comments

@squintsgeek
Copy link

In lines 2061 and 2077 in data_management.py, the %s format code is platform-dependent on *nix-like OSes, and the _validate_sql_recovery_point() method (and any dependencies that rely on this method) will abend in Windows with a "invalid string format" error:

recovery_timestamp = int(recovery_date_time.strftime('%s')) * 1000

However, this line is platform-independent, and will work with any Python version:

recovery_timestamp = (recovery_date_time-datetime(1970,1,1,0,0,0)).total_seconds() * 1000

I’ve tested the replacement in a v3.7 venv on my Windows machine, and it appears to fix the problem.

@kambleakash0
Copy link

If it is working now, then maybe close this issue?

@squintsgeek
Copy link
Author

Ah, when I say "I’ve tested the replacement [...]and it appears to fix the problem" I mean that I am able to test and validate the bug locally on my own environment. It still exists, and still affects anyone using the Data Management portion of the SDK on Windows.

Apologies for any confusion.

@guillermo-caylent
Copy link

guillermo-caylent commented Jan 25, 2023

Same problem here:

   2075                 recovery_date_time, '%Y-%m-%dT%H:%M')
   2076             # Create recovery timestamp in (ms) as integer from datetime object
-> 2077             recovery_timestamp = int(recovery_date_time.strftime('%s')) * 1000
   2078 
   2079             for range in range_summary['data']:

ValueError: Invalid format string

edit: Also, I'm using python venv 3.6.4. @squintsgeek solutions works for me

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

No branches or pull requests

3 participants