<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="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 10, 2014 at 5:39 AM, Goldberg, Arthur P <span dir="ltr"><<a href="mailto:arthur.p.goldberg@mssm.edu" target="_blank">arthur.p.goldberg@mssm.edu</a>></span> wrote:<br><blockquote class="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="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;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;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;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;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;text-align:-webkit-auto;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;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;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-align:-webkit-auto;text-indent:0px">
<div style="word-wrap:break-word">
<span style="text-align:-webkit-auto;text-indent:0px">
<div style="word-wrap:break-word">
<span style="text-align:-webkit-auto;text-indent:0px">
<div style="word-wrap:break-word">
<span style="text-align:-webkit-auto;text-indent:0px">
<div style="word-wrap:break-word">
<span style="text-align:-webkit-auto;text-indent:0px">
<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" target="_blank">Arthur.Goldberg@mssm.edu</a></div>
</div>
</div>
<div>Follow us on Twitter <a href="https://twitter.com/IcahnInstitute" target="_blank">@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>
<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="/ponyorm-list" target="_blank">/ponyorm-list</a><br>
<br></blockquote></div><br></div>