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

REST API should not be based on Hybrid properties #2764

Closed
szoupanos opened this issue Apr 16, 2019 · 0 comments · Fixed by #2793
Closed

REST API should not be based on Hybrid properties #2764

szoupanos opened this issue Apr 16, 2019 · 0 comments · Fixed by #2793
Assignees
Milestone

Comments

@szoupanos
Copy link
Contributor

Currently REST API is based on hybrid properties like the user_email defined in the DbNode table in SQLA.

This allows us to create queries where we may project node properties and also the user_email and implicitly to do the join of the DbNode with the DbUser to provide the user email.

This is a nice feature but it is a feature that it is defined at the SQLA model (not in the Django model) and we should not make assumptions that such feature exist at the REST API which is a few levels above the backends.

In general the REST API queries should change from

qh = {'project': {
    'calculations': ['id', 'label', 'node_type', 'ctime', 'mtime', 'uuid', 'user_id', 'user_email',
                     'attributes', 'extras']},
      'path': [{'tag': 'calculations', 'entity_type': 'process.calculation.calcjob.CalcJobNode.'}],
      'order_by': {'calculations': {}}, 'filters': {}}

to

qh = {
    'project':
        {
            'calc': ['id', 'label', 'node_type', 'ctime', 'mtime', 'uuid', 'user_id', 'attributes', 'extras'],
            'user_1': ['email']
        },
    'path':
        [
            {'entity_type': 'process.calculation.calcjob.CalcJobNode.', 'tag': 'calc'},
            {'edge_tag': 'calc--user_1', 'joining_keyword': 'with_node', 'entity_type': 'user',
             'joining_value': 'calc', 'tag': 'user_1'}
    ],
    'order_by': {'calc': {}}

This issue became visible after the removal of the dummy_model (for the querying of Django backrend). Work which is done to support JSONB in Djnago

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