You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will retrieve me the last record, but it still is a query:
<class 'pyorient.ogm.query.Query'>
And iterating it:
(Pdb) [print(i.aux_id) for i in queryset]
10
12
100
[None, None, None]
It retrieve me all the values and not the last one. I tried also using order_by() but I get this error:
queryset = graph.ofriends.query().order_by('aux_id')
(Pdb) [print(i.aux_id) for i in queryset]
*** AttributeError: 'str' object has no attribute 'context_name'
So, Is it possible to get the last aux_id by using order_by? How?...
class OFriendsViewSet(viewsets.ModelViewSet):
def create(self,request):
aux_id = ''
queryset = graph.ofriends.query()
# HERE is where I want to get the last aux_id
The text was updated successfully, but these errors were encountered:
I don't know how to get the last record of an edge in django rest framework, using orientdb OGM.
I'm using pyorient==1.5.5 and OrientDB 3.0.18 version.
I have a relationship (edge) called OFriends and this is what I've tried:
(Pdb) dir(graph)
['WhatFunction', 'WhatFunctions', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'getitem', 'gt', 'hash', 'init', 'iter', 'le', 'len', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_class_props', '_graph', '_params', '_subquery', 'all', 'append_what_function', 'arithmetic_string', 'build_optional_clauses', 'build_props', 'build_select', 'build_what', 'build_wheres', 'count', 'filter', 'filter_by', 'filter_string', 'first', 'group_by', 'let', 'limit', 'lock', 'one', 'order_by', 'parse_prop_name', 'parse_record_prop', 'prepare', 'rid_lower', 'sanitise_prop_name', 'scalar', 'skip', 'slice', 'source_name', 'sub', 'unique_prop_name', 'unwind', 'what', 'what_args']
I thought that using limit() as below:
Will retrieve me the last record, but it still is a query:
<class 'pyorient.ogm.query.Query'>
And iterating it:
It retrieve me all the values and not the last one. I tried also using order_by() but I get this error:
settings.py
models.py
serializers.py
api.py
The text was updated successfully, but these errors were encountered: