Hallo zusammen. Ich wollte ebenfalls meine beiden .sdb Datenbanken zusammenlegen. Sie stammen beide aus weewx. Nun bekomme ich immer diese Fehlermeldung:
root@raspberrypi:~# sqlite3 weewx.sdb_new_new SQLite version 3.16.2 2017-01-06 16:32:41 Enter ".help" for usage hints. sqlite> .read weewx.sdb_new Error: cannot open "weewx.sdb_new" sqlite> .read /home/pi/Desktop/weewx.sdb_new Error: near line 1: near "SQLite": syntax error Error: near line 403: unrecognized token: " " Error: near line 5261: near "@n�": syntax error Error: near line 5337: unrecognized token: " " Error: near line 6332: unrecognized token: " " Error: near line 6793: unrecognized token: " " Error: near line 7575: near "@rH": syntax error Error: near line 7831: near "@n�": syntax error sqlite> Hatte das jemand auch? Am Samstag, 4. Januar 2020 23:41:23 UTC+1 schrieb gjr80: > > Hallo Günther, > > Ihr Englisch ist wahrscheinlich besser als mein Deutsch, aber lassen Sie > uns sehen, wie wir gehen. Ich habe sowohl Englische als auch > Google-Deutsche Wörter eingefügt. > > Wenn ich das richtig verstehe, haben Sie zwei WeeWX SQLite-Datenbanken, > die Sie zusammenführen möchten. Leider gibt es im Utilities Guide nichts, > was Ihnen das leicht machen könnte. Dies ist ein paar Mal vorgekommen und > wenn Sie das Forum nach Beiträgen mit "merge sqlite datbase" durchsuchen, > werden Sie einige Beiträge finden, die Ihnen helfen werden. Ich würde > dieses versuchen ( > https://groups.google.com/d/msg/weewx-user/T2VuiIkcAEM/wZzemNzWknQJ) und > das ist das, was ich als Basis für das verwendet habe: > > 1. Erstellen Sie eine Sicherungskopie Ihrer beiden Datenbanken > > 2. Installieren Sie das Dienstprogramm sqlite3, falls es noch nicht > installiert ist: > > $ sudo apt-get install sqlite3 > > 3. Wählen Sie eine Ihrer Datenbanken als endgültige Datenbank aus und > benennen Sie die andere in db1.sdb um. Sie sollten jetzt zwei Datenbanken > haben, eine mit dem Namen weewx.sdb und eine andere mit dem Namen db1.sdb. > Um die Dinge später zu vereinfachen, stellen Sie sicher, dass sich > weewx.sdb in dem Verzeichnis befindet, in dem Sie Ihre WeeWX-Datenbank > dauerhaft speichern möchten (die Standardverzeichnisse sind > /home/weewx/archive für eine setup.py-Installation oder /var/lib/weewx für > alle andere installiert). Ich werde /home/weewx/archive in dieser Anleitung > verwenden > > 4. Kopieren Sie die Datenbank db1.sdb in eine Datei: > > $ sqlite3 /path/to/db1.sdb > sqlite> .output /var/tmp/db1.dump > sqlite> .dump > sqlite> .quit > > 5. Importieren Sie nun die gedumpten Daten in die endgültige Datenbank > weewx.sdb: > > $ sqlite3 /home/weewx/archive/weewx.sdb > sqlite> .read /var/tmp/db1.dump > > Sie werden wahrscheinlich Beschwerden über 'existing tables' oder 'unique > constraint failed' sehen. Diese können ignoriert werden. Es muss jedoch > etwas Ernsthafteres betrachtet werden. > > sqlite> .quit > > 6. Der nächste Schritt besteht darin, die täglichen Zusammenfassungen neu > zu erstellen. Dies erfolgt mit dem Dienstprogramm wee_database und > erfordert, dass Sie eine WeeWX-Datenbindung konfigurieren, um die jetzt > konsolidierte Datenbank weewx.sdb zu verwenden. Bearbeiten Sie die Datei > weewx.conf und suchen Sie die Zeilengruppe [Databases]. Überprüfen Sie, ob > Sie einen Datenbankeintrag für weewx.sdb haben. Dieser sollte ungefähr so > aussehen: > > [Databases] > > # A SQLite database is simply a single file > [[archive_sqlite]] > database_name = weewx.sdb > database_type = SQLite > > Wenn sich weewx.sdb in den Verzeichnissen home/weewx/archive oder > /var/lib/weewx befindet, ist das oben Genannte in Ordnung. Beachten Sie den > Eintrag in [[ ]], in diesem Fall archive_sqlite. > > Überprüfen Sie nun die Zeilengruppe [DataBindings] in der Datei weewx.conf. > > [DataBindings] > > [[wx_binding]] > # The database must match one of the sections in [Databases]. > # This is likely to be the only option you would want to change. > database = archive_sqlite > # The name of the table within the database > table_name = archive > # The manager handles aggregation of data for historical summaries > manager = weewx.wxmanager.WXDaySummaryManager > # The schema defines the structure of the database. > # It is *only* used when the database is created. > schema = schemas.wview.schema > > Sie müssen überprüfen, ob die Datenbankeinstellung in der Zeilengruppe > [[wx_binding]] den Eintrag aus der Zeilengruppe [[ ]] verwendet, den wir > zuvor in der Zeilengruppe [Databases] notiert haben, in diesem Fall > archive_sqlite. > > Sie können nun mit wee_database die täglichen Zusammenfassungen löschen > und neu erstellen. > > 7. Legen Sie die täglichen Zusammenfassungen ab und erstellen Sie sie neu: > > $ wee_database --drop-daily > $ wee_database --rebuild-daily > > Beantworten Sie die Aufforderungen nach Bedarf > > 8. Ihre konsolidierte Datenbank sollte nun vollständig und WeeWX gesetzt, > es zu benutzen. Der letzte Schritt vor dem Neustart von WeeWX besteht > darin, alle Berichte im NOAA-Format zu löschen, damit sie mit den neuen > konsolidierten Daten neu generiert werden. Suchen Sie die NOAA-Format > Berichte über Ihre WeeWX Maschine und löschen sie alle, Sie werden > wahrscheinlich die Berichte im /home/weewx/public_html/NOAA oder > /var/www/html/weewx/NOAA-Verzeichnis je nach WeeWX Art installieren finden. > > 9. Starten Sie WeeWX neu > > Überprüfen Sie Ihre Protokolle beim Start von WeeWX auf Fehler. Überprüfen > Sie Ihre Ausgabe, um festzustellen, ob die neuen konsolidierten Daten > verwendet werden. > > Gary > > Your English is probably better than my German but let us see how we go. I > have included both English and Google-German words. > > If I understand correctly you have two WeeWX SQLite databases that you > wish to merge. Unfortunately there is nothing in the Utilities Guide that > will easily do this for you. This has come up a few times before and if you > search the forum for posts with 'merge sqlite database' you will find a few > posts that will help. I would try this one ( > https://groups.google.com/d/msg/weewx-user/T2VuiIkcAEM/wZzemNzWknQJ) and > that is the one I have used as the basis for the following steps: > > 1. Make a backup copy of both your databases > > 2. Install the sqlite3 utility if it is not already installed: > > $ sudo apt-get install sqlite3 > > 3. Select one of your databases as the final database and rename the other > to say db1.sdb. You should now have two databases, one named weewx.sdb and > another named db1.sdb. To simplify things later make sure that weewx.sdb is > located in the directory where you wish to permanently store your WeeWX > database (the default locations are /home/weewx/archive for a setup.py > install or /var/lib/weewx for all other installs). I will use > /home/weewx/archive in these instructions > > 4. Dump the db1.sdb database to a file: > > $ sqlite3 /path/to/db1.sdb > sqlite> .output /var/tmp/db1.dump > sqlite> .dump > sqlite> .quit > > 5. Now import the dumped data into the final database weewx.sdb: > > $ sqlite3 /home/weewx/archive/weewx.sdb > sqlite> .read /var/tmp/db1.dump > > you will likely see some complaints about 'existing tables' or 'unique > constraint failed', these can be ignored. Though anything more serious > needs to be looked at. > > sqlite> .quit > > 6. The next step is to rebuild the daily summaries, this is done with the > wee_database utilitiy and requires that you configure a WeeWX data binding > to use the now consolidated database weewx.sdb. Edit weewx.conf and locate > the [Databases] stanza. Check you have a database entry there for > weewx.sdb, it should look something like: > > [Databases] > > # A SQLite database is simply a single file > [[archive_sqlite]] > database_name = weewx.sdb > database_type = SQLite > > if weewx.sdb is in the home/weewx/archive or /var/lib/weewx directories > then the above is fine. Take note of the entry in the [[ ]], in this case > archive_sqlite. > > Now check the [DataBindings] stanza in weewx.conf, it will likely look > like this: > > [DataBindings] > > [[wx_binding]] > # The database must match one of the sections in [Databases]. > # This is likely to be the only option you would want to change. > database = archive_sqlite > # The name of the table within the database > table_name = archive > # The manager handles aggregation of data for historical summaries > manager = weewx.wxmanager.WXDaySummaryManager > # The schema defines the structure of the database. > # It is *only* used when the database is created. > schema = schemas.wview.schema > > You need to check that the database setting in the [[wx_binding]] stanza > uses the entry from the [[ ]] stanza that we previously noted in the > [Databases] stanza, in this case archive_sqlite. > > You can now use wee_database to drop and rebuild the daily summaries. > > 7. Drop and rebuild the daily summaries: > > $ wee_database --drop-daily > $ wee_database --rebuild-daily > > answering any prompts as required > > 8. Your consolidated database should now be complete and WeeWX set to use > it. The final step before restarting WeeWX is to delete all the NOAA format > reports so that they are re-generated with the new consolidated data. > Locate the NOAA format reports on your WeeWX machine and delete them all, > you will likely find the reports in the /home/weewx/public_html/NOAA or > /var/www/html/weewx/NOAA directory depending on your WeeWX install type. > > 9. Restart WeeWX > > Check your logs from WeeWX startup for errors. Check your output to see > that the new consolidated data is being used (checking the NOAA reorts is a > good and simple check for this) > > On Sunday, 5 January 2020 01:14:24 UTC+10, Günther Wrana wrote: >> >> Ich habe nun schon die ganze Seite >> >> WeeWX Utilities Guide >> >> mir durchgelesen. >> Aber ich verstehe immer noch nicht wie ich die alten Werte in die neue >> Datenbank bekomme. >> >> Beide Datenbanken wurden mit weewx erstellt und von der selben >> Wetterstation mit Werten befüllt. >> >> Der einzige Unterschied ist eine Zeit lang war die Wetterstation an einen >> PC mit Ubuntu angeschlossen, dann an einen Raspberry. >> Es gibt keine Zeit Überschneidung oder sonstiges. >> >> Ich möchte nur alle Werte in einer Datenbank haben das ich die Messwerte >> mir über längere Zeit zurück ansehen kann. >> >> Beide Datenbanken heißen weewx.sdb nur mir unterschiedlichen Größen und >> Zeitstempeln. >> >> Wie lege ich das an das ich diese beiden Datenbanken zusammen führe, oder >> besser gesagt was verstehe ich nicht. >> >> wee_database >> wee_import >> wee_reports >> >> *I apologize but my English is not yellow from the egg so I write German.* >> >> -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0b6c5e25-1165-4455-bb63-d9f3617f0344%40googlegroups.com.
