I finished my pyweboff demo with it. I like how it flows. What do you think of the idea?
On 3/8/06,
Michael Bayer <[EMAIL PROTECTED]> wrote:
call commit() on objectstore, or the session itself, i.e.objectstore.get_session().commit()the ORM-level commit is completely different from the engine-level commit() :) .On Mar 9, 2006, at 12:33 AM, Jonathan Ellis wrote:I'm trying to create an api (sqlalchemy.simple?) that allows unsophisticated db manipulation without explicit table classes. (Code attached.) Seems to work fine except I can't get inserts to work. My objects go into the UnitOfWork but they still do not get committed. I suspect it's something simple to get them marked "dirty" for commit, but my code diving patience for the evening is exhausted. Help? :)
Demo of the problem:
CREATE TABLE books (
id serial PRIMARY KEY,
title text NOT NULL,
published_year char(4) NOT NULL,
authors text NOT NULL
);
from sqlalchemy import create_engine
engine = create_engine('postgres', {'database': 'pyweboff', 'user': 'spyce', 'password': 'spyce'})
db = DbSoup(engine)
db.books(title='foo', published_year='1111', authors='asdf')
from sqlalchemy import objectstore
print objectstore.get_session().uow.new # there it is!
db.commit()
# but no new rows in books!
--
Jonathan Ellis
http://spyced.blogspot.com<soup.py>
--
Jonathan Ellis
http://spyced.blogspot.com