Skip to content
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

Get data from API without SQLite #40

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

JrtPec
Copy link
Contributor

@JrtPec JrtPec commented Jun 14, 2018

Storing data in a local SQLite DB isn't always convenient, for instance when using TMPO in a microservice where you have no permanent storage. I added functionality to download and parse TMPO data directly from the API without storing it in between. It should all be backwards compatible.

  • The certificate was removed from the code, and added as a file in the package.
  • The code has been moved away from __init__.py.
  • The Session class does not exists anymore, there are two new classes: APISession and SQLiteSession.
  • APISession contains all API calls, block processing, and pandas parsing. It grabs data directly from the API without intermediate storage.
  • SQLiteSession subclasses APISession and has the existing functionality that involves the local SQLite DB.
  • SQLiteSession is completely backwards compatible with the old Session. So you can import it using from tmpo import Session and from tmpo import SQLiteSession. Same thing.

I will start using the code next week on EnergyID, so any bugs should be gone by then.

I have only tested this on Python3, I don't know (and don't care) if this works on PY2.

* typo in tz_localize

* tmpo delete query

* reset method

* version bump

* Split `SQL_TMPO_LAST` into `SQL_TMPO_LAST` (which now doesn't include data) and `SQL_TMPO_LAST_DATA` (which does include data).

Sync uses the one without data to determine from where to start.

* pd.tslib.Timestamp will be deprecated, use pd.Timestamp instead

* `ix` is deprecated, changed to `loc`

* upgrade of notebook

* version bump

* also update docstrings for Timestamp depreciation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant