I wish I knew more about SQL programming, but, alas, I know just enough to
get by. I'd be very grateful for opinions from a true expert.

On Fri, Dec 22, 2023 at 12:35 PM Raoul Snyman <[email protected]>
wrote:

> Actually, the columns names are fine for me, it was the expression inside
> the SUM function which was throwing me off.
>
> I set up a test database in SQLite and ran those queries, and it looks
> like they are actually just doing a count (boolean true becomes 1, sum of a
> bunch of 1s is a count). I'm going to test changing those queries to
> count() and moving the expression into the where clause.
>
> On Friday, December 22, 2023 at 1:15:09 PM UTC Tom Keffer wrote:
>
>> Typically, this is used to calculate the number of days of precipitation
>> greater than some amount during a time span, using the daily summaries. The
>> parameter %(val)s is the value.
>>
>> In retrospect, the choice of column names in the daily summaries may not
>> have been a good one. The values "sum" in the expression "SUM(sum>90)"
>> represent two different things. The first sum ("SUM") is an aggregation,
>> the second sum ("sum") is a column name.
>>
>> Perhaps you can escape the inner "sum"?
>>
>> -tk
>>
>> On Thu, Dec 21, 2023 at 10:12 PM Raoul Snyman <[email protected]>
>> wrote:
>>
>>> I've been going through the queries in xtypes.py, and I've come across
>>> some queries that don't make sense to me, and definitely throw errors in
>>> PostgreSQL.
>>>
>>> For example:
>>>
>>> SELECT SUM(sum >= %(val)s) FROM %(table_name)s_day_%(obs_key)s WHERE
>>> dateTime >= %(start)s AND dateTime < %(stop)s
>>>
>>> SUM(sum >= 90) is not valid in PostgreSQL. Can you tell me what this is
>>> supposed to be doing, then perhaps I can translate the SQL into something
>>> that's more generic?
>>>
>>> Thanks!
>>>
>>> On Tuesday, December 12, 2023 at 3:27:19 PM UTC Raoul Snyman wrote:
>>>
>>>> On Tuesday, December 12, 2023 at 2:15:31 PM UTC matthew wall wrote:
>>>>
>>>> On Monday, December 11, 2023 at 11:47:04 PM UTC-5 Raoul Snyman wrote:
>>>>
>>>> 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"
>>>>
>>>>
>>>> i am working on the unit tests.  when we started them we just used
>>>> python directly. i am converting all of it to pytest.
>>>>
>>>> i would like to have the pytest conversion done when v5 comes out of
>>>> beta, but it might happen soon after that.
>>>>
>>>> the core in v5 is pretty solid, but we're still taking care of some
>>>> packaging and integration bits
>>>>
>>>>
>>>> Oh cool, that's good to know. I've used pytest fairly extensively, it's
>>>> a good test framework.
>>>>
>>>>
>>>>
>>> --
>>>
>> 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/b298f3e6-ead9-4c5a-8458-d204cb0ac03dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-development/b298f3e6-ead9-4c5a-8458-d204cb0ac03dn%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/4f0c1553-dd27-4831-a832-c270f2183ff6n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/4f0c1553-dd27-4831-a832-c270f2183ff6n%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/CAPq0zECBttYxapL4qrONoXf1Nmj_bz6Dyq9QDhX0PqQkhQNTwA%40mail.gmail.com.

Reply via email to