On Monday, 23 January 2017 16:25:26 UTC-8, Louis De Lange wrote: > > > > On Monday, 23 January 2017 15:37:18 UTC-8, Tom Keffer wrote: >> >> On Mon, Jan 23, 2017 at 3:20 PM, Louis De Lange <[email protected]> >> wrote: >> >>> >>> 1. The meteotemplate database uses a type datetime primary key, rather >>> than unix epoch. I could not get addRecord to work in that circumstance so >>> I ended up using a getsql function to write the record to meteotemplate. >>> >>> >> One option would be to augment the record with the datetime object that >> Meteotemplate needs. Then dateTime just gets carried along for the ride. >> Or, maybe I'm misunderstanding your architecture. >> > > I tried doing just this, but then the day calcs failed when the DateTime > type was text. However, after changing the manager to class Manager the > day summaries wont be filled and I can see that this will work. > > >> >> >>> 2. I had to add a usUnit column to the meteotemplate database because >>> weewx does a unit check and wont allow to post a new record unless the >>> usUnits column match. This is not a big deal, but is there a way around >>> that? In particular, the individual records in the meteotemplate database >>> can be any combination of units - which makes a single unit indicator >>> irrelevant, apart from making the database write possible >>> >> >> You could subclass Manager, overriding function _check_unit_system() so >> it does not do the check, or does some other check. >> > > This can be my next project to figure out how to do this... > > > >> >> >>> >>> 3. The standard db_manager = >>> self.engine.db_binder.get_manager(data_binding='name_of_binding', >>> initialize=True) function insists on adding day summary tables, and >>> when I set initialize to false and delete the unnecessary tables it >>> gives an error that the tables are missing. Is there a way to eliminate >>> the creation of the day summary tables? >>> >> >> Yes. Use class Manager, rather than DaySummaryManager. >> > > Works! Thanks. > > >> Hope this helps. >> >> -tk >> >> Just to close the loop on this discussion and help anyone else.
3. I changed the manager to class Manager and that solved the issue of the day summary tables being added. 2. I subclassed Manager ( and changed manager again to my new subclass MeteotemplateManager). But since I am using a direct database call getsql, modifying function _check_unit_system() did not work as it was not the problem. The troublesome function was _sync() which was being called every time a manager was initialized. I modified _sync() so that it wont try to find the database units and now the meteotemplate database operates without a dummy usUnits column. 1. I could not get the call to addRecord to work, but I am OK with that - since this is a non-weewx database I think I prefer the straight getsql approach. Thanks for the help on this, Tom. -- 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.
