How add a database ?

59 views
Skip to first unread message

eric9...@gmail.com

unread,
Jan 14, 2023, 2:33:59 AM1/14/23
to weewx-user
Hello everyone;

  For different reasons, I need to create a new database in which I would draw data to feed my weather page.  A bit like Cmon.

  Everything is ready except that weewx does not recognize it.

Jan 13 19:10:23 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      raise weewx.UnknownBinding("Unknown data binding '%s'" % e)
Jan 13 19:10:23 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  weewx.UnknownBinding: Unknown data binding ''weewx_tide''

  My modified 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 = user.extensions.schema_extended
    [[cmon_binding]]
        database = cmon_sqlite
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = user.cmon.schema
    [[tide_binding]]
        database = tide_sqlite
        table_name = archive
        manager = weewx.wxmanager.WXDaySummaryManager
        schema = user.extensions.schema_extended

##############################################################################

#   This section defines various databases.

[Databases]
   
    # A SQLite database is simply a single file
    [[archive_sqlite]]
        database_name = weewx.sdb
        database_type = SQLite
    [[tide_sqlite]]
        database_name = weewx_tide.sdb
        database_type = SQLite
       
    # MySQL
    [[archive_mysql]]
        database_name = weewx
        database_type = MySQL
    [[cmon_sqlite]]
        database_type = SQLite
        database_name = cmon.sdb

eric9...@gmail.com

unread,
Jan 14, 2023, 2:39:07 AM1/14/23
to weewx-user
sorry, but I couldn't find any documentation for this.  I tried to mimic the changes made by Cmon, but obviously that's not enough.

gjr80

unread,
Jan 14, 2023, 3:43:03 AM1/14/23
to weewx-user
The error trace is exactly correct; you do not have a binding named weewx_tide, that is the name of your database. Your binding is tide_binding. Presumably you are trying to use your binding in tag(s) in a report, in that case you need to look at the tags and ensure you are using tide_binding as your binding.

Gary

eric9...@gmail.com

unread,
Jan 14, 2023, 4:59:17 AM1/14/23
to weewx-user
Ok, I understand. Stupide mistake !

But the error continues. I post the entire error log :


Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.belchertown.HighchartsJsonGenerator'
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  Unknown data binding ''tide_biding''
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 857, in get_manager_dict_from_config
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      manager_dict = dict(config_dict['DataBindings'][data_binding])
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/usr/lib/python3/dist-packages/configobj.py", line 554, in __getitem__
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      val = dict.__getitem__(self, key)
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  KeyError: 'tide_biding'
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  During handling of the above exception, another exception occurred:
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/reportengine.py", line 197, in run
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      obj.start()
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/reportengine.py", line 385, in start
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      self.run()
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/user/belchertown.py", line 1547, in run
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      archive = self.db_binder.get_manager(binding)
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 752, in get_manager
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      manager_dict = get_manager_dict_from_config(self.config_dict,
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 859, in get_manager_dict_from_config
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****      raise weewx.UnknownBinding("Unknown data binding '%s'" % e)
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  weewx.UnknownBinding: Unknown data binding ''tide_biding''
Jan 14 10:40:42 raspberrypi weewx[5806] ERROR weewx.reportengine:         ****  Generator terminated

eric9...@gmail.com

unread,
Jan 14, 2023, 5:01:36 AM1/14/23
to weewx-user
I precise my weewx_tide.sdb is in /home/weewx/archive/ with weewx.sdb and cmon.sdb

gjr80

unread,
Jan 14, 2023, 5:13:38 AM1/14/23
to weewx-user
Again the error trace is your fiend. You have a typo, tide_binding != tide_biding

Gary

eric9...@gmail.com

unread,
Jan 14, 2023, 5:36:34 AM1/14/23
to weewx-user
Oh, I'm tired... Sorry. 

Thanks for your help. It works. 

Reply all
Reply to author
Forward
0 new messages