Re: [sqlalchemy] Does twophase=True limit to only two databases at the same time?

2015-08-14 Thread Jinghui Niu
Oh by the way, I'm using SQLite as backend.
On Aug 14, 2015 2:04 AM, Jinghui Niu niujing...@gmail.com wrote:

 I have three different DBs, one is person.db, another is journal.db, yet
 another is tag.db. In the documentation it reads:

 Vertical partitioning places different kinds of objects, or different
 tables, across multiple databases:


 engine1 = create_engine('postgresql://db1')

 engine2 = create_engine('postgresql://db2')


 Session = sessionmaker(twophase=True)


 # bind User operations to engine 1, Account operations to engine 2

 Session.configure(binds={User:engine1, Account:engine2})


 session = Session()


 I noticed that this example only deals with two DBs, and the parameter is
 called twophase. I was wondering if there is any significance of two
 here? How can I fit my third DB in? Thanks.

 --
 You received this message because you are subscribed to a topic in the
 Google Groups sqlalchemy group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/sqlalchemy/tRlV984I_64/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Does twophase=True limit to only two databases at the same time?

2015-08-14 Thread Jinghui Niu
I have three different DBs, one is person.db, another is journal.db, yet 
another is tag.db. In the documentation it reads:

Vertical partitioning places different kinds of objects, or different 
 tables, across multiple databases:


 engine1 = create_engine('postgresql://db1')

 engine2 = create_engine('postgresql://db2')


 Session = sessionmaker(twophase=True)


 # bind User operations to engine 1, Account operations to engine 2

 Session.configure(binds={User:engine1, Account:engine2})


 session = Session()


I noticed that this example only deals with two DBs, and the parameter is 
called twophase. I was wondering if there is any significance of two 
here? How can I fit my third DB in? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Does twophase=True limit to only two databases at the same time?

2015-08-14 Thread Mike Bayer



On 8/14/15 5:07 AM, Jinghui Niu wrote:


Oh by the way, I'm using SQLite as backend.

On Aug 14, 2015 2:04 AM, Jinghui Niu niujing...@gmail.com 
mailto:niujing...@gmail.com wrote:


I have three different DBs, one is person.db, another is
journal.db, yet another is tag.db. In the documentation it reads:

Vertical partitioning places different kinds of objects,
or different tables, across multiple databases:


engine1 = create_engine('postgresql://db1')

engine2 = create_engine('postgresql://db2')


Session = sessionmaker(twophase=True)


# bind User operations to engine 1, Account operations to
engine 2

Session.configure(binds={User:engine1, Account:engine2})


session = Session()


I noticed that this example only deals with two DBs, and the
parameter is called twophase. I was wondering if there is any
significance of two here? How can I fit my third DB in? Thanks.



twophase refers to enabling two-phase commit on supporting backends, 
which does not include SQLite.   See 
https://en.wikipedia.org/wiki/Two-phase_commit_protocol.





-- 
You received this message because you are subscribed to a topic in

the Google Groups sqlalchemy group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/sqlalchemy/tRlV984I_64/unsubscribe.
To unsubscribe from this group and all its topics, send an email
to sqlalchemy+unsubscr...@googlegroups.com
mailto:sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com
mailto:sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google 
Groups sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to sqlalchemy+unsubscr...@googlegroups.com 
mailto:sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com 
mailto:sqlalchemy@googlegroups.com.

Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Does twophase=True limit to only two databases at the same time?

2015-08-14 Thread Jonathan Vanasco
twophase deals with the transaction commit protocol , and is unlreated to 
anything else in your example. 
 
(http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.params.twophase)

You'd simply create an engine3 and bind whatever object classes to it.

FWIW.  Sqlite does not support two-phase commits.   Fore more info on 
two-phase commits - https://en.wikipedia.org/wiki/Two-phase_commit_protocol


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.