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

Implement farfetch #242

Closed
dimitri-yatsenko opened this issue Sep 6, 2016 · 10 comments
Closed

Implement farfetch #242

dimitri-yatsenko opened this issue Sep 6, 2016 · 10 comments
Assignees
Labels
Milestone

Comments

@dimitri-yatsenko
Copy link
Member

dimitri-yatsenko commented Sep 6, 2016

Within _make_tuples functions, it may be possible to automate query formation for fetching data that can be uniquely identified by its attribute name.

For example,

nslices = (preprocess.Prepare.Galvo() & key).fetch1['nslices'] 
traces  = (preprocess.ExractTraces.Traces() & key).fetch['trace']  

would be replaced with

nslices, traces = dj.get('nslices', 'traces')

This is intended to work from _make_tuples only since it will need to know its place in the data hierarchy and the value of key.

@dimitri-yatsenko dimitri-yatsenko added this to the Release 0.3 milestone Sep 6, 2016
@dimitri-yatsenko dimitri-yatsenko self-assigned this Sep 6, 2016
@dimitri-yatsenko dimitri-yatsenko changed the title Fetch by attribute names alone with dj.get Fetch by attribute name Sep 6, 2016
@eywalker
Copy link
Contributor

eywalker commented Sep 6, 2016

An alternative suggestion for the syntax.

search = self.search(key)     # create the search object
nslices = search['nslices']      # fetch nslices

# tables containing the attributes are joined if they are in the same search call
traces, rois = search['trace', 'roi']      # fetch matched traces and ROIs from different tables

@dimitri-yatsenko
Copy link
Member Author

I like it. This will allow more portable code that relies on descriptive attribute names and survives changes in the schema design.

@dimitri-yatsenko
Copy link
Member Author

Another discussion and a different syntax.

nslices = (self & key).search1['nslices']      # fetch nslices as a scalar.

# tables containing the attributes are joined if they are in the same search call
traces, rois = (self & key).search['trace', 'roi']      # fetch matched traces and ROIs from different tables

@dimitri-yatsenko
Copy link
Member Author

dimitri-yatsenko commented Sep 6, 2016

Another syntax

search = self.search(key)
nslices = search.fetch1['nslices']      # fetch nslices as a scalar.

# tables containing the attributes are joined if they are in the same search call
traces, rois =  search.fetch['trace', 'roi']  

@dimitri-yatsenko
Copy link
Member Author

Another syntax

nslices = self.get1(key, ['nslices'])      # fetch nslices as a scalar.

# tables containing the attributes are joined if they are in the same search call
traces, rois =  self.get(key, ['trace', 'roi']) 

@eywalker
Copy link
Contributor

eywalker commented Sep 7, 2016

Between the last two, I'd prefer the search.fetch1 and search.fetch syntax, allowing us to not repeat key argument.

@fabiansinz
Copy link
Contributor

I agree with @eywalker although I'd still prefer to rename search into something else.

@eywalker
Copy link
Contributor

eywalker commented Sep 8, 2016

Do we have running candidates on what to rename search to?

@dimitri-yatsenko
Copy link
Member Author

dimitri-yatsenko commented Feb 13, 2017

I propose farfetch. It's catchy and conveys its unusual power.

nslices = (rel & key).farfetch1['nslices']
traces = (rel & key).farfetch['traces']

@dimitri-yatsenko dimitri-yatsenko removed this from the Release 0.3 milestone Apr 17, 2017
@dimitri-yatsenko dimitri-yatsenko changed the title Fetch by attribute name Implement farfetch Apr 17, 2017
@dimitri-yatsenko dimitri-yatsenko added this to the Release 0.10 milestone Jul 26, 2017
@dimitri-yatsenko dimitri-yatsenko modified the milestones: Release 0.11, Release 0.13, Release 0.14 Oct 19, 2018
@eywalker eywalker removed this from the Release 0.14 milestone Aug 1, 2019
@eywalker eywalker added this to the Concept milestone Apr 14, 2020
@dimitri-yatsenko
Copy link
Member Author

I am removing this since this can lead to indeterministic behaviors. In the Pipeline Navigator and with new AI-based tools, we will provide tools for composing queries, but queries must be precise.

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

No branches or pull requests

3 participants