Software > WeeWX
Toqueteo de la base de datos - Errores, inconsistencias, añadir registros
garbatella:
Hola.
Acudo a vosotros a ver si alguien puede echarme una mano en la delicada tarea de toquetear las bases de datos.
Tengo un registro muy reciente, de tan sólo tres días. Y lo que ocurre es que el primer día (21 de Octubre) está basado totalmente en datos falsos (fake) generados por el simulador cuando instalé weewx.
Lo primero que he hecho ha sido entender que esa fecha, en conversión con el epoch sería: 1634767200. Lo segundo ha sido parar weewx, y acceder con sqlite3 y he mandado los siguientes comandos:
--- Código: ---select datetime(dateTime, 'unixepoch', 'localtime') dateTime from archive where dateTime <1634767200;
--- Fin del código ---
--- Código: ---delete from archive where dateTime <1634767200;
--- Fin del código ---
Hasta aquí todo ok (y espero que esté bien hecho *+*). Luego he hecho lo siguiente, y es donde vienen los resultados confusos:
--- Código: ---wee_database weewx.conf --drop-daily
--- Fin del código ---
Y me devuelve:
--- Código: ---Traceback (most recent call last):
File "/usr/share/weewx/wee_database", line 1138, in <module>
main()
File "/usr/share/weewx/wee_database", line 186, in main
config_path, config_dict = weecfg.read_config(options.config_path, args)
File "/usr/share/weewx/weecfg/__init__.py", line 173, in read_config
locations=locations, file_name=file_name)
File "/usr/share/weewx/weecfg/__init__.py", line 147, in find_file
raise IOError("%s is not a file" % file_path)
--- Fin del código ---
Y finalmente lanzo:
--- Código: ---wee_database weewx.conf --reubild-daily
--- Fin del código ---
Y me devuelve:
--- Código: ---Usage: wee_database --help
wee_database --create
wee_database --reconfigure
wee_database --transfer --dest-binding=BINDING_NAME [--dry-run]
wee_database --add-column=NAME [--type=(REAL|INTEGER)]
wee_database --rename-column=NAME --to-name=NEW_NAME
wee_database --drop-columns=NAME1,NAME2,...
wee_database --check
wee_database --update [--dry-run]
wee_database --drop-daily
wee_database --rebuild-daily [--date=YYYY-mm-dd |
[--from=YYYY-mm-dd] [--to=YYYY-mm-dd]]
[--dry-run]
wee_database --reweight [--date=YYYY-mm-dd |
[--from=YYYY-mm-dd] [--to=YYYY-mm-dd]]
[--dry-run]
wee_database --calc-missing [--date=YYYY-mm-dd |
[--from=YYYY-mm-dd[THH:MM]] [--to=YYYY-mm-dd[THH:MM]]]
wee_database --check-strings
wee_database --fix-strings [--dry-run]
Description:
Manipulate the WeeWX database. Most of these operations are handled
automatically by WeeWX, but they may be useful in special cases.
wee_database: error: no such option: --reubild-daily
--- Fin del código ---
Soy consciente que el dropeo y el rebuild han ido mal. ¿Alguna razón de por qué? He levantado weewx de nuevo, y en teoría todo sigue igualmente operativo y con todos los registros...
jmviper:
Hola
Estás en la ruta de weewx.conf ??
Sino es así ponle la ruta:
sudo wee_database /etc/weewx/weewx.conf --drop-daily
Mejor con sudo delante si estás como usuario pi.
Puedes prescindir de poner la ruta de weewx.conf también.
En principio esos son los comandos correctos.
garbatella:
Pues efectivamente, me puse en la ruta de weewx.conf y funcionó correctamente el drop-daily:
--- Código: ---Using configuration file weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_sqlite'
Proceeding will delete all your daily summaries from database 'weewx.sdb'
Are you sure you want to proceed (y/n)? y
Dropping daily summary tables from 'weewx.sdb' ...
Daily summary tables dropped from database 'weewx.sdb' in 0.29 seconds
--- Fin del código ---
Pero a la hora del reubild, nada de nada. Es muy raro, porque me salta la ayuda y no parece que permita hacer un reubild-daily sin indicarle una fecha, o un periodo:
--- Código: ---root@raspberrypi:/etc/weewx# wee_database weewx.conf --reubild-daily
Usage: wee_database --help
wee_database --create
wee_database --reconfigure
wee_database --transfer --dest-binding=BINDING_NAME [--dry-run]
wee_database --add-column=NAME [--type=(REAL|INTEGER)]
wee_database --rename-column=NAME --to-name=NEW_NAME
wee_database --drop-columns=NAME1,NAME2,...
wee_database --check
wee_database --update [--dry-run]
wee_database --drop-daily
wee_database --rebuild-daily [--date=YYYY-mm-dd |
[--from=YYYY-mm-dd] [--to=YYYY-mm-dd]]
[--dry-run]
wee_database --reweight [--date=YYYY-mm-dd |
[--from=YYYY-mm-dd] [--to=YYYY-mm-dd]]
[--dry-run]
wee_database --calc-missing [--date=YYYY-mm-dd |
[--from=YYYY-mm-dd[THH:MM]] [--to=YYYY-mm-dd[THH:MM]]]
wee_database --check-strings
wee_database --fix-strings [--dry-run]
Description:
Manipulate the WeeWX database. Most of these operations are handled
automatically by WeeWX, but they may be useful in special cases.
wee_database: error: no such option: --reubild-daily
--- Fin del código ---
jmviper:
Has puesto reubild no rebuild
garbatella:
:; Eso que decían cuando ibas al colegio o la universidad de: "antes de empezar a responder el examen, lee con calma la pregunta"... madre mía. Gracias jmviper, qué paciencia tienes!
Pues hecho, y sin problemas. Por supuesto antes de hacerlo he parado weewx y luego lo he iniciado de nuevo.
Bien, pues el toqueteo en la base de datos no debe haber sido muy correcto, porque sigo viendo los registros erróneos. Échales un ojo si tienes un momento, los tengo aquí:
http://naxos.synology.me/weewx/reports
Verás que los del día 21 son un sinsentido, como digo son datos falsos del simulador cuando se monta weewx por primera vez.
No sé, desde mi poco conocimiento de sql, con esa instrucción que dije se habría eliminado lo del día 21...?
Navegación
[#] Página Siguiente
[*] Página Anterior
Ir a la versión completa