<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Python hdbcli executemany returns minus when there's... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/python-hdbcli-executemany-returns-minus-when-there-s-no-affected-records/qaa-p/13701177#M4829356</link>
    <description>&lt;P&gt;One option may be to use the code below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ret_count = cursor.executemany("DELETE FROM PERSON WHERE ID = ? AND NAME = ?", [[1, 'Jack']], batcherrors=True) # ok
print(cursor.getrowsaffectedcounts())&lt;/LI-CODE&gt;&lt;P&gt;See also &lt;A href="https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/fee219d4d534465fa3bdfdfc8bc7cd9d.html" target="_self"&gt;getrowsaffectedcounts() Method&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 16:36:11 GMT</pubDate>
    <dc:creator>Dan_vL</dc:creator>
    <dc:date>2024-05-14T16:36:11Z</dc:date>
    <item>
      <title>Python hdbcli executemany returns minus when there's no affected records</title>
      <link>https://community.sap.com/t5/technology-q-a/python-hdbcli-executemany-returns-minus-when-there-s-no-affected-records/qaq-p/13697213</link>
      <description>&lt;P&gt;Hi, I don't know why the `executemany()` calls of Python hdbcli library returns -2 rather than 0.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    cursor.execute("CREATE TABLE PERSON ( ID INTEGER, NAME NVARCHAR(50), AGE INTEGER, CITY NVARCHAR(50), PRIMARY KEY (ID, NAME) )")
    print("INSERT ===")
    ret_count = cursor.executemany("INSERT INTO PERSON VALUES (?, ?, ?, ?)", [[1, 'Jack', 15, 'SF']])
    print(ret_count)
    print("UPDATE ===")
    ret_count = cursor.executemany("UPDATE PERSON SET AGE = 25 WHERE NAME = ? AND ID = ?", [['Jack', 1]]) # ok
    print(ret_count)
    ret_count = cursor.executemany("UPDATE PERSON SET AGE = 25 WHERE NAME = ? AND ID = ?", [['Jack', 2]]) # partial match
    print(ret_count)
    ret_count = cursor.executemany("UPDATE PERSON SET AGE = 25 WHERE NAME = ? AND ID = ?", [['Anna', 3]]) # none of them
    print(ret_count)
    print("DELETE ===")
    ret_count = cursor.executemany("DELETE FROM PERSON WHERE ID = ? AND NAME = ?", [[1, 'Anna']]) # partial match
    print(ret_count)
    ret_count = cursor.executemany("DELETE FROM PERSON WHERE ID = ? AND NAME = ?", [[1, 'Jack']]) # ok
    print(ret_count)
    ret_count = cursor.executemany("DELETE FROM PERSON WHERE ID = ? AND NAME = ?", [[1, 'Jack']]) # none of them&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;It's output is,&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;INSERT ===
(1,)
UPDATE ===
(1,)
(-2,)
(-2,)
DELETE ===
(-2,)
(1,)
(-2,)&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;I did in the latest version,&amp;nbsp;hdbcli==2.20.15. Could you explain the reason? Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 07:07:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/python-hdbcli-executemany-returns-minus-when-there-s-no-affected-records/qaq-p/13697213</guid>
      <dc:creator>JongheonPark</dc:creator>
      <dc:date>2024-05-10T07:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python hdbcli executemany returns minus when there's...</title>
      <link>https://community.sap.com/t5/technology-q-a/python-hdbcli-executemany-returns-minus-when-there-s-no-affected-records/qaa-p/13701177#M4829356</link>
      <description>&lt;P&gt;One option may be to use the code below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ret_count = cursor.executemany("DELETE FROM PERSON WHERE ID = ? AND NAME = ?", [[1, 'Jack']], batcherrors=True) # ok
print(cursor.getrowsaffectedcounts())&lt;/LI-CODE&gt;&lt;P&gt;See also &lt;A href="https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/fee219d4d534465fa3bdfdfc8bc7cd9d.html" target="_self"&gt;getrowsaffectedcounts() Method&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 16:36:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/python-hdbcli-executemany-returns-minus-when-there-s-no-affected-records/qaa-p/13701177#M4829356</guid>
      <dc:creator>Dan_vL</dc:creator>
      <dc:date>2024-05-14T16:36:11Z</dc:date>
    </item>
  </channel>
</rss>

