<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div style="word-wrap:break-word">Hi Alexander
<div><br>
</div>
<div>Thanks! Yes, your simple program works.</div>
<div>As far as I know, I'm using 1 thread, and I'd like to switch between different dbmses. </div>
<div>Basically, I'm using</div>
<div>bind()</div>
<div>generate_mapping()</div>
<div>disconnect()</div>
<div>
<div>bind()</div>
</div>
<div><br>
</div>
<div>and getting </div>
<div>
<div>TypeError: Database object was already bound to MySQL provider</div>
</div>
<div>on the 2nd bind().</div>
<div><br>
</div>
<div>Here's a bit of my code.</div>
<div>test program t.py</div>
<div>the connection manager, geneticsDBMScommon.py</div>
<div>a shared singleton database handle, theDB.py</div>
<div>geneticsSubjects and geneticsClasses just define classes.<br>
<br>
</div>
<div>I can simplify the example if you like.</div>
<div><br>
</div>
<div>A</div>
<div><br>
</div>
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
<div><br>
</div>
<div><br>
<div>
<div>On Dec 10, 2014, at 6:06 PM, Alexander Kozlovsky <<a href="mailto:alexander.kozlovsky@gmail.com">alexander.kozlovsky@gmail.com</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<blockquote type="cite">
<div dir="ltr">
<div>
<div>Hi Arthur!<br>
<br>
</div>
<div>For what purpose do you want to use `disconnect` method? I'm not sure I correctly understand what example you want to see, but the simplest example of `disconnect` method is this:<br>
</div>
<div><br>
</div>
    from pony.orm import *<br>
<br>
    db = Database('mysql', host="myhost", user="me", passwd="123", db="mydb")<br>
<br>
    class Person(db.Entity):<br>
        name = Required(str)<br>
<br>
    db.generate_mapping(create_tables=True)<br>
<br>
    with db_session:<br>
        p1 = Person(name='John')<br>
<br>
    db.disconnect()<br>
<br>
</div>
<br>
The disconnect method works for current thread only. It releases connection to the server which db object holds in its connection pool.<br>
<div><br>
</div>
<div>This method should be called outside of any db session.<br>
</div>
<div><br>
</div>
<div>If you application is multi-threaded and you want to disconnect your db object from the database, the you need to call `disconnect` method from each thread in which you have worked with the entities of this db object.<br>
</div>
<div><br>
<br>
</div>
<div>Regards,<br>
</div>
<div>Alexander Kozlovsky<br>
</div>
<div><br>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Wed, Dec 10, 2014 at 5:39 AM, Goldberg, Arthur P <span dir="ltr">
<<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailto-3Aarthur.p.goldberg-40mssm.edu&d=AAMFaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=MdhUTa5GEj8B5HsquznH3IF3hQvAX2z34nrPC35Fbqc&s=ct-V7Z7acRopVeskia8UT4P3-cU9cGjInrFDZss0TLk&e=" target="_blank">arthur.p.goldberg@mssm.edu</a>></span>
 wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div style="word-wrap:break-word">Hi Guys
<div><br>
</div>
<div>Could you please show an example with disconnect()? I'm using a couple of dbmses in one SQL server, and getting </div>
<div>
<div>Database object was already bound to MySQL provider</div>
<div>Sorry, I'm too rushed to debug carefully.</div>
<div><br>
</div>
<div>Yhanks</div>
<div>A</div>
<div><br>
</div>
<div><br>
<div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; word-wrap:break-word">
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; word-wrap:break-word">
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; word-wrap:break-word">
<span style="border-collapse:separate; border-spacing:0px">
<div style="word-wrap:break-word"><span style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
<div style="word-wrap:break-word"><span style="text-indent:0px">
<div style="word-wrap:break-word"><span style="text-indent:0px">
<div style="word-wrap:break-word"><span style="text-indent:0px">
<div style="word-wrap:break-word"><span style="text-indent:0px">
<div style="word-wrap:break-word"><span style="text-indent:0px">
<div style="word-wrap:break-word">
<div style="word-wrap:break-word">
<div style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
<div style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
---</div>
<div> </div>
<div>Arthur Goldberg
<div style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
Associate Professor of Psychiatry</div>
<div>Seaver Autism Center and Icahn Institute for Genomics & Multiscale Biology</div>
<div>Icahn School of Medicine at Mount Sinai</div>
<div style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
Seaver Center, Room ABE-33</div>
<div style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
212-241-4229<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailto-3AArthur.Goldberg-40mssm.edu&d=AAMFaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=MdhUTa5GEj8B5HsquznH3IF3hQvAX2z34nrPC35Fbqc&s=zyJFM3R79vy0YD4o6VWXoHEs0OQXaiwdQ3nrXfBIBN8&e=" target="_blank">Arthur.Goldberg@mssm.edu</a></div>
</div>
</div>
<div>Follow us on Twitter <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__twitter.com_IcahnInstitute&d=AAMFaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=MdhUTa5GEj8B5HsquznH3IF3hQvAX2z34nrPC35Fbqc&s=b8XJr7NW4WKs0NkKVXPX5Ua1nTWBMEFE6nwzM3mLer0&e=" target="_blank">@IcahnInstitute</a></div>
<div style="border-collapse:separate; font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
<br>
</div>
</div>
</div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</div>
</div>
<br>
<br>
</div>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
ponyorm-list mailing list<br>
<a href="mailto:ponyorm-list@ponyorm.org">ponyorm-list@ponyorm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__mailman-2Dmail5.webfaction.com_listinfo_ponyorm-2Dlist&d=AAMFaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=MdhUTa5GEj8B5HsquznH3IF3hQvAX2z34nrPC35Fbqc&s=EqprhF2xxCO00Y6lH7LjUW0WmnyegTuf-EW5kECRTA8&e=" target="_blank">/ponyorm-list</a><br>
<br>
</blockquote>
</div>
<br>
</div>
_______________________________________________<br>
ponyorm-list mailing list<br>
<a href="mailto:ponyorm-list@ponyorm.org">ponyorm-list@ponyorm.org</a><br>
https://urldefense.proofpoint.com/v2/url?u=https-3A__mailman-2Dmail5.webfaction.com_listinfo_ponyorm-2Dlist&d=AAIGaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=MdhUTa5GEj8B5HsquznH3IF3hQvAX2z34nrPC35Fbqc&s=EqprhF2xxCO00Y6lH7LjUW0WmnyegTuf-EW5kECRTA8&e=
<br>
</blockquote>
</div>
<br>
<div>
<div style="color:rgb(0,0,0); font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; word-wrap:break-word">
<div style="color:rgb(0,0,0); font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; word-wrap:break-word">
<div style="color:rgb(0,0,0); font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; word-wrap:break-word">
<span class="x_Apple-style-span" style="border-collapse:separate; border-spacing:0px">
<div style="word-wrap:break-word"><span class="x_Apple-style-span" style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; border-spacing:0px; font-size:medium">
<div style="word-wrap:break-word"><span class="x_Apple-style-span" style="orphans:2; text-indent:0px; widows:2">
<div style="word-wrap:break-word"><span class="x_Apple-style-span" style="orphans:2; text-indent:0px; widows:2">
<div style="word-wrap:break-word"><span class="x_Apple-style-span" style="orphans:2; text-indent:0px; widows:2">
<div style="word-wrap:break-word"><span class="x_Apple-style-span" style="orphans:2; text-indent:0px; widows:2">
<div style="word-wrap:break-word"><span class="x_Apple-style-span" style="orphans:2; text-indent:0px; widows:2">
<div style="word-wrap:break-word">
<div style="word-wrap:break-word">
<div style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
<div style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
---</div>
<div> </div>
<div>Arthur Goldberg
<div style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
Associate Professor of Psychiatry</div>
<div>Seaver Autism Center and Icahn Institute for Genomics & Multiscale Biology</div>
<div>Icahn School of Medicine at Mount Sinai</div>
<div style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
Seaver Center, Room ABE-33</div>
<div style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
212-241-4229<br>
<a href="mailto:Arthur.Goldberg@mssm.edu">Arthur.Goldberg@mssm.edu</a></div>
</div>
</div>
<div>Follow us on Twitter <a href="https://twitter.com/IcahnInstitute">@IcahnInstitute</a></div>
<div style="border-collapse:separate; color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-transform:none; white-space:normal; word-spacing:0px; border-spacing:0px; font-size:medium">
<br>
</div>
</div>
</div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</div>
</div>
<br class="x_Apple-interchange-newline">
<br class="x_Apple-interchange-newline">
</div>
<br>
</div>
</div>
</body>
</html>