-
Notifications
You must be signed in to change notification settings - Fork 124
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
Update to maintenance.py to fix errors and the script bailing #448
base: master
Are you sure you want to change the base?
Conversation
After my Sqlite3 db got huge, I checked the logs and found that the maint script was generating errors. - changed 'purge_flights = row' to 'purge_flights = int(row[0])' this explicitly gets the first result in the array and casts it to an int as the value returned from the DB (column type is TEXT') is unicode Have NOT tested on MySQL
In both MySQL and SQLite, fetchone() either returns a single row, or returns None when there is no more data available. I don't understand why you need to select the first column and cast it to an integer. What error are you seeing in the maintenance script log? |
From what I understand fetchone() is not that simple. row = fetchone() gives a value of row of "u'60'," for a purgeDaysOld db value of 60 for example. Perhaps a better fix would be to replace the FYI these are the errors I get with the script:, using purge_days_old as an example.
casting to int - purge_days_old = int(row) explicitly selecting element 0 with purge_days_old = row[0] |
using |
Out of interest, what are you getting if you run
You're right that I'm thinking that there must be a |
using python2 to run these scripts - Python 2.7.15 checked with |
reverted changes to purgeAircraft, purgeFlights, purgePositions as these are used as simple TRUE/FALSE tests. split the changes to purge_days_old to to using the more popular seeming fetchone()[0] and a seperate cast to int
This doesn't work now with mysql:
|
After my Sqlite3 db got huge, I checked the logs and found that the maint script was generating errors.
changed 'purge_flights = row' to 'purge_flights = int(row[0])'
this explicitly gets the first result in the array and casts it to an int as the value returned from the DB (column type is TEXT') is unicode
added missed datetime.
Have NOT tested on MySQL