Re: intent of "numeric" paramstyle, wrt actual numbers not numerically ordered?

Marc-Andre Lemburg <[email protected]> Fri, 2 Dec 2022 18:56:54 +0100
Newsgroups gmane.comp.python.db
Organization eGenix.com Software GmbH; http://www.egenix.com/
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============6332112702826053910==
Content-Type: multipart/alternative;
 boundary="------------PjG6D3mnWDwrZ0DHjzoujpWa"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------PjG6D3mnWDwrZ0DHjzoujpWa
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 02.12.2022 18:32, John Stevenson - BGS wrote:
>
> The documents officially state “named” as the paramstyle, but with 
> cx_Oracle we often use the numeric style with executemany so that we 
> can insert from lists of tuples.  In this context, the useful 
> “feature” of the numeric paramstyle is that you don’t need to 
> transform your data into a dictionary.
>
> https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle
>
> I haven’t tried binding the same value multiple times or using the 
> placeholders in different orders, though.
>
cx_Oracle seems to use "named" style, but simply binds by position when 
passing in a tuple instead of a dictionary (or keyword args). At least 
that's what the docs suggest:

https://cx-oracle.readthedocs.io/en/latest/user_guide/bind.html

I suppose that using "where a=:2 and b=:1" would still bind the first 
parameter value to "a" and the second to "b".

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Dec 02 2022)
>>> Python Projects, Coaching and Support ...    https://www.egenix.com/
>>> Python Product Development ...        https://consulting.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::
     
    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611
                https://www.egenix.com/company/contact/
                      https://www.malemburg.com/

--------------PjG6D3mnWDwrZ0DHjzoujpWa
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 02.12.2022 18:32, John Stevenson -
      BGS wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:LO2P123MB5142A5B59A26DF20B9B16D4E81179@LO2P123MB5142.GBRP123.PROD.OUTLOOK.COM">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <div class="WordSection1">
        <p class="MsoNormal"><span>The documents officially state
            “named” as the paramstyle, but with cx_Oracle we often use
            the numeric style with executemany so that we can insert
            from lists of tuples.  In this context, the useful “feature”
            of the numeric paramstyle is that you don’t need to
            transform your data into a dictionary.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span><a
href="https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#cx_Oracle.paramstyle</a></span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>I haven’t tried binding the same
            value multiple times or using the placeholders in different
            orders, though.</span></p>
      </div>
    </blockquote>
    <p>cx_Oracle seems to use "named" style, but simply binds by
      position when passing in a tuple instead of a dictionary (or
      keyword args). At least that's what the docs suggest:</p>
    <p><a class="moz-txt-link-freetext" href="https://cx-oracle.readthedocs.io/en/latest/user_guide/bind.html">https://cx-oracle.readthedocs.io/en/latest/user_guide/bind.html</a></p>
    <p>I suppose that using "where a=:2 and b=:1" would still bind the
      first parameter value to "a" and the second to "b". <br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Dec 02 2022)
&gt;&gt;&gt; Python Projects, Coaching and Support ...    <a class="moz-txt-link-freetext" href="https://www.egenix.com/">https://www.egenix.com/</a>
&gt;&gt;&gt; Python Product Development ...        <a class="moz-txt-link-freetext" href="https://consulting.egenix.com/">https://consulting.egenix.com/</a>
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::
    
   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               <a class="moz-txt-link-freetext" href="https://www.egenix.com/company/contact/">https://www.egenix.com/company/contact/</a>
                     <a class="moz-txt-link-freetext" href="https://www.malemburg.com/">https://www.malemburg.com/</a>

</pre>
  </body>
</html>

--------------PjG6D3mnWDwrZ0DHjzoujpWa--

--===============6332112702826053910==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
DB-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/db-sig

--===============6332112702826053910==--