<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">May be I am not reading it right from the documentation.<br><br>As per the documentation, to use the open method for db.open, the format to use is<br><tt class="descname">open</tt><big>(</big><em>filename</em>, <em>dbname=None</em>, <em>dbtype=DB_UNKNOWN</em>, <em>flags=0</em>, <em>mode=0660</em>, <em>txn=None</em><big>)</big><span style="text-decoration: underline;"><br><br></span><span style="font-family: arial,helvetica,sans-serif;">so here</span> I would think this is what I need to do to open a new db right.?<br>db1.open("Temp.db", None, db.DB_BTREE, db.DB_CREATE)<br><br>here dbtype is DB_BTREE and <em>flags is </em>db.DB_CREATE right.?<br>http://www.jcea.es/programacion/pybsddb_doc/db.html<br><br>I understand that if there are more than 2 flags we might need to provide it with a bitOR operator like DB_CREATE | <code
 class="literal">DB_AUTO_COMMIT</code><br><br>-----<br>On the second email from the documentation, don't know C, so I don't know how to approach it. For now I think will stick with loading and retrieving one value at a time.<br><br>Thanks for all your help and thoughts.<br><br>Thanks<br><br>--- On <b>Sat, 3/27/10, hasanyasin <i>&lt;hasanyasin@cubicpen.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: hasanyasin &lt;hasanyasin@cubicpen.com&gt;<br>Subject: Re: [pybsddb] Bulk Data load into a DB<br>To: "Python bindings for Oracle Berkeley DB" &lt;pybsddb@jcea.es&gt;<br>Date: Saturday, March 27, 2010, 7:10 PM<br><br><div id="yiv759588951">


  
Flags are integers in fact and we operate "bitwise or" ie. | operator,
on them to create one integer. So, instead of writing db.DB_BTREE,
db.DB_CREATE you need to write db.DB_BTREE|db.DB_CREATE. The code you
provided at your mail would work but not as aimed.<br>
<br>
I DB_MULTIPLE is defined in module bsddb3.db, so in order to use it you
need to type db.DB_MULTIPLE in your case since you have imported db
from bsddb3.<br>
<br>
The real exception we get here is TypeError complaining as: "string or
integer object expected for key, tuple found." So, it seems current
interface does not yet support this feature.<br>
<br>
hasanyasin<br>
<br>
<br>
On 27.03.2010 20:41, Joepaul Puthenangadi wrote:
<blockquote type="cite">
  <table border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">Sorry about that. Should have been more verbose. My bad.<br>
        <br>
############<br>
This is what I did initially<br>
        <br>
from bsddb3 import db<br>
        <br>
db1 = db.DB()<br>
        <br>
db1.open("Temp.db", None, db.DB_BTREE, db.DB_CREATE)<br>
        <br>
db1.put('abc%200105%Key1','jp1p')<br>
db1.put('abc%200105%Key2','jp2p')<br>
        <br>
db1.close()<br>
        <br>
Worked&nbsp; great<br>
############<br>
Then, was trying to add more keys to it in&nbsp; the bulk format. And was
trying to think that a tuple of keys and tuple of values in one put
will be the way to get the bulk data loaded. That was the code pasted
earlier. This is command i used from the last post<br>
        <br>
db1.put(keys, val, None, DB_MULTIPLE)<br>
        <br>
Then you get this error message <br>
NameError: name 'DB_MULTIPLE' is not defined<br>
        <br>
So my thought was may be this feature is still not implemented. Just
want to see what members here thought.<br>
        <br>
Appreciate all your help and discussions.<br>
Thanks<br>
        <br>
        <br>
--- On <b>Sat, 3/27/10, hasanyasin <i><a rel="nofollow" class="moz-txt-link-rfc2396E" ymailto="mailto:hasanyasin@cubicpen.com" target="_blank" href="/mc/compose?to=hasanyasin@cubicpen.com">&lt;hasanyasin@cubicpen.com&gt;</a></i></b>
wrote:<br>
        <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>
From: hasanyasin <a rel="nofollow" class="moz-txt-link-rfc2396E" ymailto="mailto:hasanyasin@cubicpen.com" target="_blank" href="/mc/compose?to=hasanyasin@cubicpen.com">&lt;hasanyasin@cubicpen.com&gt;</a><br>
Subject: Re: [pybsddb] Bulk Data load into a DB<br>
To: "Python bindings for Oracle Berkeley DB" <a rel="nofollow" class="moz-txt-link-rfc2396E" ymailto="mailto:pybsddb@jcea.es" target="_blank" href="/mc/compose?to=pybsddb@jcea.es">&lt;pybsddb@jcea.es&gt;</a><br>
Date: Saturday, March 27, 2010, 1:57 AM<br>
          <br>
          <div id="yiv910964059"> Hi,<br>
I am not sure if that feature is interfaced in pybsddb yet; but before
that, I will ask you some other things: When you are opening a db, it
would be better to provide dbtype and flags so we can see what the
dbtype and flags of it are. Also, if that db did not exist already, it
won't open without DB_CREATE flag. The name "DB_MULTIPLE" is not
importad to global scope so you can access it via "db" module name as
db.DB_MULTIPLE.<br>
          <br>
In addition to these, saying "this didn't work" does not give any clues
to us. Please provide the exceptions throwed.<br>
          <br>
Have a good day,<br>
hasanyasin<br>
          <br>
On 27.03.2010 00:38, Joepaul Puthenangadi wrote:
          <blockquote type="cite">
            <table border="0" cellpadding="0" cellspacing="0">
              <tbody>
                <tr>
                  <td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top"><span style="font-family: arial,helvetica,sans-serif;">Hi
there,</span><br style="font-family: arial,helvetica,sans-serif;">
                  <br style="font-family: arial,helvetica,sans-serif;">
                  <span style="font-family: arial,helvetica,sans-serif;">Was
reading
through the documentation and found something on the oracle
website about the possibility of loading bulk key and values into a
hash or btree db using the flag = </span><code style="font-family: arial,helvetica,sans-serif;" class="literal">DB_MULTIPLE.
Not
trying to be picky or anything just wanted to know whether that is
something yet to be implemented to </code><span style="font-family: arial,helvetica,sans-serif;">bsddb3 module.?</span><br style="font-family: arial,helvetica,sans-serif;">
                  <br style="font-family: arial,helvetica,sans-serif;">
                  <span style="font-family: arial,helvetica,sans-serif;">Again
thanks
a lot for the wonderful module.</span><br style="font-family: arial,helvetica,sans-serif;">
                  <br style="font-family: arial,helvetica,sans-serif;">
                  <span style="font-family: arial,helvetica,sans-serif;">Thanks
again</span><br>
                  <br>
#Sample code<br>
                  <code class="literal"><br>
                  </code>from bsddb3 import db<br>
                  <br>
db1 = db.DB()<br>
db1.open("Temp.db")<br>
                  <br>
keys = ('key1','key2','key3')<br>
val = ('10','15','20')<br>
                  <br>
db1.put(keys, val, None, DB_MULTIPLE)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
db1.close()<br>
                  <br>
###<br>
This did not work. Any thoughts.?<br>
                  <br>
Thanks<br>
                  </td>
                </tr>
              </tbody>
            </table>
            <br>
            <pre><fieldset class="mimeAttachmentHeader"></fieldset><br>_______________________________________________<br>pybsddb mailing list<br><a rel="nofollow" class="moz-txt-link-abbreviated">pybsddb@jcea.es</a><br><a rel="nofollow" class="moz-txt-link-freetext" target="_blank"  href="https://mailman.jcea.es:28443/listinfo/pybsddb">https://mailman.jcea.es:28443/listinfo/pybsddb</a><br><a rel="nofollow" class="moz-txt-link-freetext" target="_blank" href="http://www.jcea.es/programacion/pybsddb.htm">http://www.jcea.es/programacion/pybsddb.htm</a></pre>
          </blockquote>
          </div>
          <br>
-----Inline Attachment Follows-----<br>
          <br>
          <div class="plainMail">_______________________________________________<br>
pybsddb mailing list<br>
          <a rel="nofollow">pybsddb@jcea.es</a><br>
          <a rel="nofollow" target="_blank"  href="https://mailman.jcea.es:28443/listinfo/pybsddb">https://mailman.jcea.es:28443/listinfo/pybsddb</a><br>
          <a rel="nofollow" target="_blank" href="http://www.jcea.es/programacion/pybsddb.htm">http://www.jcea.es/programacion/pybsddb.htm</a></div>
        </blockquote>
        </td>
      </tr>
    </tbody>
  </table>
  <br>
  <pre><fieldset class="mimeAttachmentHeader"></fieldset><br>_______________________________________________<br>pybsddb mailing list<br><a rel="nofollow" class="moz-txt-link-abbreviated" ymailto="mailto:pybsddb@jcea.es" target="_blank" href="/mc/compose?to=pybsddb@jcea.es">pybsddb@jcea.es</a><br><a rel="nofollow" class="moz-txt-link-freetext" target="_blank"  href="https://mailman.jcea.es:28443/listinfo/pybsddb">https://mailman.jcea.es:28443/listinfo/pybsddb</a><br><a rel="nofollow" class="moz-txt-link-freetext" target="_blank" href="http://www.jcea.es/programacion/pybsddb.htm">http://www.jcea.es/programacion/pybsddb.htm</a></pre>
</blockquote>
 
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>pybsddb mailing list<br><a ymailto="mailto:pybsddb@jcea.es" href="/mc/compose?to=pybsddb@jcea.es">pybsddb@jcea.es</a><br><a href="https://mailman.jcea.es:28443/listinfo/pybsddb" target="_blank">https://mailman.jcea.es:28443/listinfo/pybsddb</a><br><a href="http://www.jcea.es/programacion/pybsddb.htm" target="_blank">http://www.jcea.es/programacion/pybsddb.htm</a></div></blockquote></td></tr></table><br>