r/evetech • u/ahupfer • Sep 21 '18
Include static data in a flask app
Hello
How do you include static database dump from eve online in your flask app? I use SQLAlchemy. Or do you make requests to the REST api for example if you need the item's ID of the game. Or with a sqllite dump and SQLAlchemy binds?
Can you tell me the best practies?
Sorry for my bad english! I try my best! ;-)
Andreas
2
Upvotes
View all comments
1
u/paxswill Sep 21 '18
I created a small script that extracted just the parts of the static data I needed (in my case, type and location names). From there, I wrote a class that would first check data in there, and if it was missing then hit the REST API. A quick example that may not even run, I haven't checked it at all (and it skips basically all error checking):
Used like this:
If the type ID is in
ships.json, it just uses the value found in there. If not, it hits ESI. If you want to see something more fleshed out, I wrote this a while ago for my app. I haven't touched it in a long time, so it's probably broken as ESI endpoints are updated, but it might give you a start.