Hi there,
I have seen some basic examples online showing that SQLAlchemy
supports "twophase = True" for some databases.
My question is I am needing to use this sort of functionality with 2
SQLite databases, does SQLAlchemy support SQLite two phase commits?
So here is some basic code
engine_1 = create_engine('sqlite:///queue_1.db')
engine_2 = create_engine('sqlite:///queue_2.db')
metadata_1 = MetaData(engine_1)
queue_one = Table('Queue_1', metadata_1, autoload=True)
mapper(Queue_1, queue_one)
metadata_2 = MetaData(engine_2)
queue_two = Table('Queue_2', metadata_2, autoload=True)
mapper(Queue_2, queue_two)
Session = sessionmaker(twophase=True)
Session.configure(binds={Queue_1:engine_1,
Queue_2:engine_2})
session = Session()
#Work with the session...
session.commit()
Also, can someone please let me know how I can work with the session
properly here when using a two phase commit using SQLite? If I run the
following:
message = session.query(Queue_1).filter(queue_one.c.ID ==
"1234").first()
The above line works fine without a two phase commit, why when I run
it now does it raise a "NotImplementedError" in "base.py"?
def do_begin_twophase(self, connection, xid):
"""Begin a two phase transaction on the given connection."""
raise NotImplementedError()
Any help will be greatly appreciated ;-)
Kind regards
Lynton
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.