-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'I/O operation on closed file' and SQL syntax error on some data download requests #44
Comments
The error message contains a list of variables that were being queried (ids 505, 507, ...) and this can tell us some useful information.
Apart from some other questionable items such as the linefeed in the |
The easy (easier) fix for this is to update the
A more laborious and in principle fully robust fix is to quote the A third solution may be to modify the code that creates new variables (crmprtd, for example) such that it modifies invalid |
The following query shows that a relatively small number of stations, all in the FLNRO-FERN network, have variables with a NB: There are many other variables with problem
|
Final note: We can remove this problem by one of the measures noted above, but it does not address another salient fact, which is that downloads of these stations crap out in a highly unsatisfactory and uninformative way. See #8 and #26 for related but not identical problems. I suspect the problem lies in this code, which does not catch any errors that may occur while processing the "responders", which are the objects that produce data for inclusion in the request response. |
If we wanted to go the route of quoting the use of
We'd have to look into where they get used, but I believe that it would only be in output data. So cells of a CSV or XLSX file, or variable names in a NetCDF file. Worth exploring. A 4th option would be to put a check constraint on that column, such that only SQL identifiers are valid data. That way no automated process or manual entry would be able to add data with spaces (or other incompatible characters). |
Nice to know about the SQLAlchemy quoting. I don't think it can be applied here, as all this takes place in stored procedures in the database. In particular, the function
Hmm. I think the only immediate problem might be with a NetCDF file; I'll look into variable name syntax there. However, even if we can use a funny variable name in both cases, it might be awkward for the users of the file. Maybe better to enforce syntax up front. I thought of check constraint over the weekend, too. Glad to hear you validate the idea. It might be the simplest way to do it.
|
This problem has recurred and/or is still present:
We can also re-run the previous query, which gives station names associated to these:
The new variables have pretty much multiplied the old problem by 5. It looks as if we may not have fixed the original "Snow Depth" variable, or else it has been re-added. And there are now several others. |
We can see if we did or did not fix the problem earlier with this query:
Argh, we did not. Bad on us. Given the prior analysis, I vote for:
|
Here's the first outing:
So the change to But somehow at that point it doesn't find |
@jameshiebert suggested
First to try is a different r/w user, namely |
As James pointed out, user
Check results:
Good. |
For the moment, this ought to solve this particular problem. Will close when evidence that things are working better comes in. |
The text was updated successfully, but these errors were encountered: