Raise FileNotFoundError if sql backend tries to read a file that does not exist#1045
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1045 +/- ##
=======================================
Coverage 81.54% 81.54%
=======================================
Files 140 140
Lines 15400 15400
=======================================
Hits 12558 12558
Misses 2842 2842 Continue to review full report at Codecov.
|
dwhswenson
left a comment
There was a problem hiding this comment.
Good catch! The fact that we have to do all this file handling ourselves frustrating, but it comes from the fact that most SQL databases don't really use a file model.
Tiny changes, mainly to use the SQLAlchemy as sql as in sqlbackend.py.
SQLAlchemy 1.4 made a bunch of changes. It's essentially a preview of their 2.0 while still maintaining some backward compatibility. There may be a number of other things we will have to change at some point, but they do have a clear migration guide. I think it's okay to require 1.4 even though it was just released in March, since I don't think we need to have backward compatibility for things in the experimental package.
Co-authored-by: David W.H. Swenson <dwhs@hyperblazer.net>
|
@dwhswenson added the suggestions, please have another look.
Yeah, I understand how from an sql perspective that they would just create a file if it does not exists. In this case we should deal with it to prevent users getting confused. I was mainly thrown for a loop when I did |
dwhswenson
left a comment
There was a problem hiding this comment.
LGTM! Merging.
Correcting my previous statement:
since I don't think we need to have backward compatibility for things in the experimental package.
Should read: "I don't think we need to support old versions of requirements for things in the experimental package." I do think that at this point we need to support backward compatibility of files as much as possible. (Files made with today's version should open in tomorrow's version.)
I tried reading a file that did not exist in that directory, this lead to 2 things happening:
This PR ( in 7d90a63) adds logic to raise a FileNotFound error with a test
Implementing the code and running that test led to some Warning/Errors being raised, so I fixed those in the following commits:
293c867 resolves an error my coding enviroment was throwing about
selfnot being defined in aclassmethod3d8f488 resolves a couple
DeprecationWarning: invalid escape sequence \((or\.)inside regex strings and resolves some pep8 complaints in touched filesb8d6947 resolves
SADeprecationWarning: The Engine.table_names() method is deprecated and will be removed in a future release. Please refer to Inspector.get_table_names(). (deprecated since: 1.4)in the proposed way (documentation link) and removes a leftoverpytest.skip()at the end of a completed test