question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

txng.collection(col).insert(row, return_new=True) does not return a new row

See original GitHub issue

return_new=True work perfectly as announced with normal insertion into a collection. However an insertion using an transaction manager does not return anything like:

row = txn.collection('mycol').insert(data, return_new=True)
# row always None

Tested with 3.11.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
dancollins34commented, Nov 5, 2017

So it looks like you might be able to do something like this in your query:

txn = db.transaction(write=col_name)
result = txn.execute(
    command='''
    function (params) {{
        var db = require('internal').db;
        var a = db.{col}.save({{ '_key': '1', 'val': params.one }});
        var b = db.{col}.save({{ '_key': '2', 'val': params.two }});
        return [a,b];
    }}'''.format(col=col_name),
    params={'one': 3, 'two': 4}
)

And that should return the meta information including the _key on each object.

0reactions
joowanicommented, May 8, 2018

@zopyx In python-arango version 4.0.0, transactions return job objects allowing result retrieval after commit. You can read more about it here. Please note that 4.0.0 is not backward compatible and you may need to significantly change your code. Cheers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return inserted row - sql - Stack Overflow
You could insert the row and then use SCOPE_IDENTITY() to get the ID of the row you inserted and return the row with...
Read more >
Can the 'returning' clause return source columns that are not ...
The documentation on the RETURNING clause says: An expression to be computed and returned by the INSERT command after each row is inserted....
Read more >
How to insert as well as return the inserted row in the same ...
I have the following (kotlin), trying to insert a new user row as well as return the same from the same method in...
Read more >
Fix the Error while inserting Row or Column in Excel - YouTube
When you try to insert rows or columns into a Microsoft Excel 2007 to 2016 or higher version worksheet, you may receive an...
Read more >
SQL Server: Return Newly Inserted Row
The rows inserted into the table are captured in the virtual table INSERTED and returned back as a result set. In case you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found