Sure (some data redacted). This is a stripped down version of the original function purely for debugging this issue.
It calls some other functions as well, but the important bit (I think) is that the print statement before the return shows the correct data.
@anvil.server.callable
def run_service_stats(country,start_date=None,end_date=None):
db=DB("redacted")
sql="""
SELECT
country, SUM(calls) as calls, round(SUM((billmsec/1000)/60),2) as mins,
round(SUM((billmsec/1000)/60) / sum(calls),2) as ACD
FROM <redacted>
where billmsec>0
and country=%s
and cast(stamp as date) between %s and %s
group by country;
"""
params=(str(country),str(start_date),str(end_date))
data = db.fetch_summary_stats(sql,params)
print("HERE")
print(data)
return data
edit - might be relevant that I am using Python 3.6 in the server whilst the client is using 2.7-ish (according to the docs).
Well, nothing obvious sticks out to me. First, have you tried replacing the 2 occurrences of the triple quotes with single quotes in the assignment to the sql variable? Second, can you provide actual example values for start_date and end_date? Third, the 2 different versions of Python could be the issue - Ian/Meredydd? Fourth, perhaps it is a Skuplt problem.
Some more detail - I am calling this server function from a repeating panel’s line item form.
Reason that might be relevant is that a very similar function (returning the same type of data) is run from the parent and works fine. However, running a different function that also does a DB lookup doesn’t fail…almost certainly something I’m doing wrong, but the error doesn’t help me pin point it.
Do Decimals now works as a data type that can be sent through Anvil server calls? My (third party) database is full of them and being able to use them would be nice!