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

Give Object instances that represent "datasets" the ability to be queried #287

Closed
davecap opened this issue Dec 17, 2018 · 2 comments · Fixed by #331
Closed

Give Object instances that represent "datasets" the ability to be queried #287

davecap opened this issue Dec 17, 2018 · 2 comments · Fixed by #331

Comments

@davecap
Copy link
Member

davecap commented Dec 17, 2018

It can be confusing that Objects are also Datasets but they don't have the same helper functions (like "query()". If an Object is a type "dataset", it should be possible to at least query it. How can we blend the Dataset class into the Object class?

One way is to have different sub-classes for each Object type, like DatasetObject, FileObject, FolderObject. Or we can deprecate the Dataset class itself and replace it with a subclass of Object (called Dataset), and add File and Folder subclasses.

@jsh2134
Copy link
Contributor

jsh2134 commented Nov 6, 2019

in #315 I added a pass-through for query() so now you can do Object.retrieve(dataset_id).query(**)

however there are still 10+ other methods that are on the Dataset object that may be wanted (dataset.beacon(), dataset.activity() etc...)

@davecap
Copy link
Member Author

davecap commented Nov 6, 2019

What about adding a __getattr__ and returning the result of getattr(Dataset, "attr") if the object type is dataset? We can limit the list of valid attrs to "beacon, activity, etc.." if we want.

jsh2134 added a commit that referenced this issue Apr 24, 2020
jsh2134 added a commit that referenced this issue Apr 24, 2020
* get or create for an Object (also closes #326)

* add Object getattr for #287

* handle other cases

* update

* update examples

* add a note

* use Object lookup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants