That looks like a good, solid start! Well done. There are some other places in the code that are database-dependent. In particular, look at the queries in weewx/xtypes.py, dictionary "group_defs". Maybe you can figure out a way around that.
I don't think the lookup table you supplied in postgres.py will survive the test of time. There are just too many types out there in the wild to ever capture them in a static structure. Whenever you create a table, I think it will be necessary to save the original names in database metadata, then return that when needed. Make sure you don't drift too far away from the V5 code. I don't see any major refactoring coming up, but I can't guarantee it either. -tk On Mon, Dec 11, 2023 at 8:47 PM Raoul Snyman <[email protected]> wrote: > I just wanted to give a little feedback. > > Firstly, I have WeeWX logging stuff into PostgreSQL and generating the > Season report without issues. > > But.... I did have to change some stuff outside of the DB driver. There > are a lot of assumptions built into the system, specifically around > non-standard SQL which MySQL uses and SQLite allows because of MySQL. > > I've tried to make things slightly more DB-agnostic, and moved a couple > things to the base Connection object so that they can be overridden. It's > not very pretty, but it works. > > I still don't have the tests running properly, I couldn't find any docs on > exactly how to set up the tests, and both the MySQL and PostgreSQL tests > fail when I just run "make test" > > Anyway, here's what I have so far: > https://github.com/rsnyman/weewx/commit/9bbeaad0d4492092d5c068e076a85dd7f6c42a0f > > > On Monday, December 4, 2023 at 10:41:30 AM UTC Cameron D wrote: > >> Thanks, I understand the issue a bit better now. It looks more like a >> case of whether the DB system is case-preserving. Sqlite is case-preserving >> but case-insensitive, whereas pg looks more like case-modifying and >> case-insensitive (unless identifiers are quoted). Running the mysql server >> in case-insensitive mode (1) will cause similar problems to pg. >> >> On Monday, 4 December 2023 at 1:07:19 pm UTC+10 Raoul Snyman wrote: >> >>> On Monday, December 4, 2023 at 2:20:38 AM UTC Cameron D wrote: >>> >>> I don't understand the problem. >>> My MariaDB server is set to *case-sensitive* (file-system and table >>> names). The column names are mainly camel case (using a trimmed down >>> version of the old schema with original names, such as 'inTemp' and 'rain'). >>> I have a second instance with an ecowitt DB where the column names are >>> mixed camel and snake (I took standard CamelCase name and added identifying >>> suffixes with an underscore). And, of course, all the archive table names >>> are snake with possible camel suffixes, matching the original column name. >>> >>> >>> PostgreSQL is NOT case-sensitive. It converts everything to lowercase in >>> order to bypass any case sensitivity issues. The problem is that WeeWX is >>> expecting the database to be case-sensitive. >>> >>> >> -- > You received this message because you are subscribed to the Google Groups > "weewx-development" 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-development/00d99404-07bc-4a26-a75a-6c4de377aba8n%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-development/00d99404-07bc-4a26-a75a-6c4de377aba8n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-development" 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-development/CAPq0zECQV9m%3DkLVrEuApy02SeevFyMfGpmqK4g-KPTO9eMVrYA%40mail.gmail.com.
