-
Notifications
You must be signed in to change notification settings - Fork 0
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
Model discrete sampling geometry datasets #62
Conversation
|
||
def downgrade(): | ||
# This downgrade will dump all discrete geometry data. | ||
# TODO: Add user confirmation of downgrade? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jameshiebert what do you think?
tests/modelmeta/test_orm.py
Outdated
assert variable_alias_1.data_file_variables == [dfv_dsg_time_series_1] | ||
|
||
|
||
def test_station(test_session_with_empty_db, station_1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this test. It's too simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks well thought out to me. Admittedly, have the PEP8 fixes mixed in with substantive changes is a little distracting. Though I appreciate you having done it, please separate those out next time we run into this.
Both upgrade and downgrade have been tested on a SQLite db but not a Postgres db
I thought that we're using testing.postgresql on this repo...
|
||
def __repr__(self): | ||
return '{}({}, {}, {}, {})'.format(self.__class__.__name__, | ||
self.time_idx, self.time_end, self.time_start, self.time_set_id) | ||
return obj_repr('time_set_id time_idx time_start time_end', self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's handy.
'netcdf_variable_name disabled range_min range_max', self) | ||
|
||
|
||
class DataFileVariableDSGTimeSeries(DataFileVariable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably use a docstring here to elaborate on what DSG stands for.
|
OK, embarassing, there's this. I'll look into it and any similar packages. |
Wouldn't call that embarrassing. I didn't know about that, and it looks like a good resource. To boot, I hadn't thought through the fact that to test the database, your initial instance will be the current ORM schema. In any case, checking out
No don't worry about it. Just keep it in mind for next time. |
LGTM. Are you happy with this at present @rod-glover ? |
@jameshiebert : One small addition: Migration now makes I am happy with this now and ready to merge if you are. |
Resolves #60
Includes Alembic schema+data migration. Both upgrade and downgrade have been tested on a SQLite db but not a Postgres db.
Modifies indexer and tests to work with new ORM/schema, but only for gridded datasets, which were the kind handled originally. Indexing DSG TS datasets will be the subject of another PR.
Cleans up and PEP8-ifies v2 ORM code, which was a little untidy.
Adds tests specifically for new, polymorphic ORM for discrete sampling and gridded sampling geometries. These may seem a little superfluous, but they are a way of ensuring that we correctly understand how SQLAlchemy handles polymorphism/inheritance. Turns out it's pretty straightforward.
TODO:
In database migration, either
DataFile.*_dim_name
attributes, or? Test migration against a Postgres database? Can we (Matthew, heh) make a copy of
ce_meta
easily? That would be best.