[FIXED] Downloading Table Fails

Hello Anvil Team!

Formerly working code is now failing with an InternalError.

The program essentially downloads all data from our database, table by table, and then builds a massive Excel sheet with it using Pandas.

print(“Downloading Order Headers”)

hdr = app_tables.orderheader.search(tables.order_by("OrderID", ascending=False), q.none_of(Status=q.any_of("Canceled",))).to_csv()
hdr_df = pd.read_csv(io.BytesIO(hdr.get_bytes()))

Here’s the full error generated:

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/anvil/_server.py in get_bytes(self)
    336     def get_bytes(self):
    337         try:
--> 338             return self._fetch().get_bytes()
    339         except AnvilWrappedError as e:
    340             raise _deserialise_exception(e.error_obj)

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/anvil/_server.py in _fetch(self)
    305         if self._details is None:
    306             import anvil.server
--> 307             self._fetched = anvil.server.call("anvil.private.fetch_lazy_media", self._spec)
    308         return self._fetched
    309 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/anvil/server.py in call(fn_name, *args, **kwargs)
    284 def call(fn_name, *args, **kwargs):
    285     try:
--> 286         return _do_call(args, kwargs, fn_name=fn_name)
    287     except _server.AnvilWrappedError as e:
    288         # We need to re-raise here so that the right amount of traceback gets cut off by _report_exception

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/anvil/server.py in _do_call(args, kwargs, fn_name, live_object)
    276         raise Exception("Anvil fatal error: " + str(_fatal_error))
    277 
--> 278     return _threaded_server.do_call(args, kwargs, fn_name=fn_name, live_object=live_object)
    279 
    280 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/anvil/_threaded_server.py in do_call(args, kwargs, fn_name, live_object)
    360         return r['response']
    361     if 'error' in r:
--> 362         raise _server._deserialise_exception(r["error"])
    363     else:
    364         raise Exception("Bogus response from server: " + repr(r))

InternalError: Internal server error: 4cbffb298501

The program fails on the .get_bytes() function call. This code has been running every weekday for several weeks and just started failing this morning. Has something changed at Anvil? Is this not the best strategy to download the full table? It was/is orders of magnitude faster than trying to loop through the records and pull in linked data.

Thank you,

Jeff

This seems to have started working again without any code fixes… It failed yesterday morning and last night when I was attempting to run it manually. I attempted to run it from two different systems so I’m pretty sure that I ruled out environment issues on this end. I would be interested to know if anything changed or was resolved on the Anvil platform end that may have been related.

Thank you,

Jeff

Hi @jeff,

Thanks for the detailed report and information. This was caused by an issue we identified earlier today, which has since been fixed.

Moving this thread to Bug Reports.

Thanks for the update Bridget.

Jeff