1. use delete from ..... where ..... instead of update ... where .... 2. for more information on the syntax of SQLite commands see https://www.tutorialspoint.com/sqlite/index.htm
remember to : a) stop weewx b) always have an up-to-date backup of the database before doing standalone operations on the database!! c) check everything is looking good before d) restarting weewx On Wednesday, 14 March 2018 13:21:44 UTC+2, Richard Cain wrote: > Fantastic. I'm getting the hang of it now. I've taken out most of the bad > data using this method. Is there a way of deleting all the records for > certain times? I have the dateTime numbers I just need to delete the whole > row ie inTemp, outTemp, windSpeed etc > > On Tuesday, 13 March 2018 12:54:49 UTC, Tom Keffer wrote: >> >> Sorry about that. The names have been corrected on the Wiki. >> >> -tk >> >> On Mon, Mar 12, 2018 at 8:40 AM, Richard Cain <[email protected]> >> wrote: >> >>> OK, thanks. I thought it was a bit strange that there were two different >>> .sdb files in the example. >>> >>> Anyway, I did it again as you suggested and it seems to have worked in >>> that the gusts have been nulled, but now that I've restarted weewx it says >>> I've just had a metre of rain! >>> https://www.globalwanderings.co.uk/weather/ >>> Back to the drawing board I guess. >>> >>> Richard >>> >>> On Monday, 12 March 2018 14:02:02 UTC, Tom Keffer wrote: >>>> >>>> If you get a "no such table" error, it's probably because you're >>>> running sqlite3 on an empty database. >>>> >>>> I know you checked for that, but your check was on a different sqlite >>>> file. Run the check on backup.sdb (not mydb.sdb) >>>> >>>> -tk >>>> >>>> On Mon, Mar 12, 2018 at 6:52 AM, Richard Cain <[email protected]> >>>> wrote: >>>> >>>>> I have some erroneous data which I want to delete so I thought I would >>>>> follow the instructions on the weewx github file: cleaning up old 'bad' >>>>> data. I copied my weewx database file to my Desktop and renamed it >>>>> backup.sdb and checked it was the same size as the original. I then >>>>> copied >>>>> the instructions but got the following: >>>>> >>>>> richard@richard-ub1710:~/Desktop$ echo "SELECT * FROM archive WHERE >>>>> (windGust > 50);" | sqlite3 backup.sdbrichard@richard-ub1710:~/Desktop$ >>>>> echo "UPDATE archive SET windGust=NULL WHERE (windGust > 50);" | >>>>> sqlite3 >>>>> mydb.sdbError: near line 1: no such table: archive >>>>> richard@richard-ub1710:~/Desktop$ sqlite3 backup.sdbSQLite version >>>>> 3.19.3 2017-06-08 14:26:16Enter ".help" for usage hints.sqlite> >>>>> .tablesarchive archive_day_outTemp >>>>> archive_day_ET >>>>> archive_day_outTempBatteryStatusarchive_day_UV >>>>> archive_day_pressure archive_day__metadata >>>>> archive_day_radiation archive_day_altimeter >>>>> archive_day_rain archive_day_barometer >>>>> archive_day_rainBatteryStatus archive_day_consBatteryVoltage >>>>> archive_day_rainRate archive_day_dewpoint >>>>> archive_day_referenceVoltage archive_day_extraHumid1 >>>>> archive_day_rxCheckPercent archive_day_extraHumid2 >>>>> archive_day_soilMoist1 archive_day_extraTemp1 >>>>> archive_day_soilMoist2 archive_day_extraTemp2 >>>>> archive_day_soilMoist3 archive_day_extraTemp3 >>>>> archive_day_soilMoist4 archive_day_hail >>>>> archive_day_soilTemp1 archive_day_hailRate >>>>> archive_day_soilTemp2 archive_day_heatindex >>>>> archive_day_soilTemp3 archive_day_heatingTemp >>>>> archive_day_soilTemp4 archive_day_heatingVoltage >>>>> archive_day_supplyVoltage archive_day_inHumidity >>>>> archive_day_txBatteryStatus archive_day_inTemp >>>>> archive_day_wind archive_day_inTempBatteryStatus >>>>> archive_day_windBatteryStatus archive_day_leafTemp1 >>>>> archive_day_windDir archive_day_leafTemp2 >>>>> archive_day_windGust archive_day_leafWet1 >>>>> archive_day_windGustDir archive_day_leafWet2 >>>>> archive_day_windSpeed archive_day_outHumidity >>>>> archive_day_windchill sqlite> >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "weewx-user" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "weewx-user" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
