<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Another try: Using strings for key and value with DB_MULTIPLE flag
throws the exception traced below. So, maybe we can do it if we can
learn how to provide the method a "bulk key buffer".<br>
<br>
Traceback (most recent call last):<br>
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;<br>
bsddb3.db.DBInvalidArgError: (22, 'Invalid argument -- DB-&gt;put with
DB_MULTIPLE(_KEY) requires a bulk key buffer')<br>
<br>
On 28.03.2010 01:10, hasanyasin wrote:
<blockquote cite="mid:4BAE9050.5020505@cubicpen.com" type="cite">
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
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 cite="mid:586335.62376.qm@web111515.mail.gq1.yahoo.com"
 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  great<br>
############<br>
Then, was trying to add more keys to it in  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 moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto: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 moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto: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 moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto: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>
        <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>
_______________________________________________
pybsddb mailing list
<a moz-do-not-send="true" 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>
<a moz-do-not-send="true" 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>
<a moz-do-not-send="true" 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 moz-do-not-send="true" ymailto="mailto:pybsddb@jcea.es"
 href="/mc/compose?to=pybsddb@jcea.es">pybsddb@jcea.es</a><br>
            <a moz-do-not-send="true"
 href="https://mailman.jcea.es:28443/listinfo/pybsddb" target="_blank">https://mailman.jcea.es:28443/listinfo/pybsddb</a><br>
            <a moz-do-not-send="true"
 href="http://www.jcea.es/programacion/pybsddb.htm" target="_blank">http://www.jcea.es/programacion/pybsddb.htm</a></div>
          </blockquote>
          </td>
        </tr>
      </tbody>
    </table>
    <br>
    <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
pybsddb mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:pybsddb@jcea.es">pybsddb@jcea.es</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="https://mailman.jcea.es:28443/listinfo/pybsddb">https://mailman.jcea.es:28443/listinfo/pybsddb</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.jcea.es/programacion/pybsddb.htm">http://www.jcea.es/programacion/pybsddb.htm</a></pre>
  </blockquote>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
pybsddb mailing list
<a class="moz-txt-link-abbreviated" href="mailto:pybsddb@jcea.es">pybsddb@jcea.es</a>
<a class="moz-txt-link-freetext" href="https://mailman.jcea.es:28443/listinfo/pybsddb">https://mailman.jcea.es:28443/listinfo/pybsddb</a>
<a class="moz-txt-link-freetext" href="http://www.jcea.es/programacion/pybsddb.htm">http://www.jcea.es/programacion/pybsddb.htm</a></pre>
</blockquote>
</body>
</html>