Hallo Gary, 

the result:
*1. run  *   root@acer:/home/weewx/bin/user# ./weewxwd_config 
--clear-v2-data --wx-binding=wx_binding
Using configuration file /home/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 
'archive_mysql'
Using database binding 'wd_binding', which is bound to database 'wd_mysql'
row [266639, 264727]
'extraTemp1' and 'extraTemp2' data in database 'weewxAlt' from 2013-10-31 
22:19:00 CET (1383254340) to 2017-03-17 14:55:00 CET (1489758900) (approx 
1233 days) is about to be cleared. Any data in these fields will be 
irretrievably lost.
Are you sure you wish to proceed (y/n)? y
Done. 'extraTemp1' and 'extraTemp2' cleared in 353107 records (approx 1233 
days).
Let's check our results in database weewxAlt
353107 rows found where extraTemp1 is NULL
353107 rows found where extraTemp2 is NULL

*2. run *  root@acer:/home/weewx/bin/user# ./weewxwd_config --clear-v2-data 
--wx-binding=wx_binding
Using configuration file /home/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 
'archive_mysql'
Using database binding 'wd_binding', which is bound to database 'wd_mysql'
row [0, 0]
No 'extraTemp1' or 'extraTemp2' data found in database 'weewxAlt' that need 
to be cleared. No data changed.

Thank you very much
it works!

                                      Thanks to Tom too

Hartmut

Postscript

also the first version for the retrospective calculation of values like 
maxSolarRad, cloudbase, windrun ...
 see above 
msr = weewx.wxformulas.solar_rad_Bras(53.605963, 11.341407, 53, 
_rec['dateTime'], 2)
dbmanager_wx.updateValue(_rec['dateTime'], 'maxSolarRad', msr) 

if _rec['outTemp'] <> 0 and _rec['outHumidity'] <> 0:
       cb1 = weewx.wxformulas.cloudbase_Metric(_rec['outTemp'], 
_rec['outHumidity'], 53)
else:
        cb1 = 0
dbmanager_wx.updateValue(_rec['dateTime'], 'cloudbase', cb1)

it also works
 
Thank you

Hartmut


Am Freitag, 17. März 2017 00:57:09 UTC+1 schrieb gjr80:
>>
>> Hallo Hartmut,
>>
>> Apologies for the time I took in getting back to you. I think we have 
>> finally tracked down the issue. When I was running a similar setup to yours 
>> on a VM using SQLite everything worked as expected, extraTemp1 and 
>> extraTemp2 were set correctly. I then migrated over to MySQL and then 
>> observed the behaviour you have been experiencing. The issue as it turns 
>> out is due to python package MySQLdb turning off autocommit by default. 
>> This means we need to manually commit after making changes to the db. I had 
>> incorrectly assumed this was occurring when we exited the with statement. 
>> Try adding the highlighted line to def clear-v2-data() (about line 589):
>>
>>                         dbmanager_wx.updateValue(_rec['dateTime'], 
>> 'extraTemp1', None)
>>                         dbmanager_wx.updateValue(_rec['dateTime'], 
>> 'extraTemp2', None)
>>                         nrecs += 1
>>                     dbmanager_wx.connection.commit()
>>                     # all done, say so and give some stats
>>                     print "Done. 'extraTemp1' and 'extraTemp2' cleared 
>> in %d records (approx %d days)." %(nrecs, ndays)
>>
>> Let us know how you go. Oh, and if it works you can thank Tom, it was 
>> beyond me so I emailed for some help!
>>
>> Gary
>>
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> <http://amd350/phpmyadmin/sql.php?db=weewxAlt&table=archive&sql_query=DELETE+FROM+%60weewxAlt%60.%60archive%60+WHERE+%60archive%60.%60dateTime%60+%3D+1489592400&message_to_show=Der+Datensatz+wurde+gel%C3%B6scht.&goto=sql.php%3Fdb%3DweewxAlt%26table%3Darchive%26sql_query%3DSELECT%2B%2560dateTime%2560%252C%2B%2560extraTem>
>>>
>>

Reply via email to