From 69e419e020ea731a5bf4d4e95a6227761f01bcc7 Mon Sep 17 00:00:00 2001 From: pinchsp Date: Tue, 4 Sep 2012 00:51:45 -0300 Subject: [PATCH] Fixed small mistake in sqlalchemy pattern --- docs/patterns/sqlalchemy.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/patterns/sqlalchemy.rst b/docs/patterns/sqlalchemy.rst index 270fa79e..c6200187 100644 --- a/docs/patterns/sqlalchemy.rst +++ b/docs/patterns/sqlalchemy.rst @@ -42,7 +42,7 @@ Here the example `database.py` module for your application:: engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True) db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, - bind=engine)) + bind=engine)) Base = declarative_base() Base.query = db_session.query_property() @@ -130,7 +130,7 @@ Here is an example `database.py` module for your application:: metadata = MetaData() db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, - bind=engine)) + bind=engine)) def init_db(): metadata.create_all(bind=engine) @@ -189,7 +189,7 @@ To insert data you can use the `insert` method. We have to get a connection first so that we can use a transaction: >>> con = engine.connect() ->>> con.execute(users.insert(name='admin', email='admin@localhost')) +>>> con.execute(users.insert(), name='admin', email='admin@localhost') SQLAlchemy will automatically commit for us.