Closed strugee closed 2 years ago
@strugee I just released new version 1.0.1. Now it support three: db_file_path
, download_url
, engine
parameters for SearchEngine
that can solve this problem.
In your case, you could create the sqlalchemy.engine.Engine
yourself (See this example), and pass in as an parameter SearchEngine(engine=engine)
So you can manage your db file your self, or event load the data to a MySQL / Postgres database. See this example
This is awesome @MacHu-GWU. Thank you for your hard work on this library, I really appreciate it :-)
Describe the bug
If the dataset is corrupted in some way, uszipcode will silently redownload it.
To Reproduce
Steps to reproduce the behavior:
import uszipcode; uszipcode.SearchEngine()
to trigger a downloadecho > path/to/simple_db.sqlite
to truncate the fileExpected behavior
At the very least a warning should be logged to console. I think probably this should throw an exception though. The current behavior can be really confusing in environments where this file is vendored into a deploy artifact, but something goes wrong with the deploy. (In our case it was that Git LFS wasn't configured, so we got the "pointer" file instead of the actual database.) That's why I think it's better to just error out: it makes it much, much easier to notice the problem.
Screenshots
N/A
Additional context
N/A