jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.19k stars 324 forks source link

get_lookup_table() should allow passing in True so that table can be stored #239

Closed dhmistry3 closed 1 year ago

dhmistry3 commented 2 years ago

As an environmental variable or something there should be a way to pass a parameter of True here so that the register can be saved.

https://github.com/jldbc/pybaseball/blob/master/pybaseball/playerid_lookup.py#L79

bdilday commented 2 years ago

I don't know if this is the way we want the API to work. I would think playerid_lookup should be concerned with looking up players only and not have to know anything about saving the intermediate data structures. I think because get_client caches the client the download would happen at most once per session which at least makes the impact less tha if it downloaded every time. You can also call cahdwick_register yourself with argument save=True and it'll get saved and then the saved version will be used by playerid_lookup, even though playerid_lookup wasnt the function that did the saving.

I dunno @schorrm @TheCleric @tjburch any other thoughts?