From 8089eb576915e71e3238147631bb4a261b3366f6 Mon Sep 17 00:00:00 2001 From: Christopher Su Date: Thu, 19 Sep 2013 23:31:09 -0700 Subject: [PATCH 1/2] added missing import in sqlalchemy doc --- docs/patterns/sqlalchemy.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/patterns/sqlalchemy.rst b/docs/patterns/sqlalchemy.rst index 07a762d8..fef9b2e9 100644 --- a/docs/patterns/sqlalchemy.rst +++ b/docs/patterns/sqlalchemy.rst @@ -177,7 +177,7 @@ SQL Abstraction Layer If you just want to use the database system (and SQL) abstraction layer you basically only need the engine:: - from sqlalchemy import create_engine, MetaData + from sqlalchemy import create_engine, MetaData, Table engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True) metadata = MetaData(bind=engine) From 9cecf0d81c58e5d0727d83e4ee11352997546354 Mon Sep 17 00:00:00 2001 From: Christopher Su Date: Tue, 22 Oct 2013 11:37:35 -0700 Subject: [PATCH 2/2] moved Table import to next code block --- docs/patterns/sqlalchemy.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/patterns/sqlalchemy.rst b/docs/patterns/sqlalchemy.rst index fef9b2e9..3c4d9ce9 100644 --- a/docs/patterns/sqlalchemy.rst +++ b/docs/patterns/sqlalchemy.rst @@ -177,7 +177,7 @@ SQL Abstraction Layer If you just want to use the database system (and SQL) abstraction layer you basically only need the engine:: - from sqlalchemy import create_engine, MetaData, Table + from sqlalchemy import create_engine, MetaData engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True) metadata = MetaData(bind=engine) @@ -185,6 +185,8 @@ you basically only need the engine:: Then you can either declare the tables in your code like in the examples above, or automatically load them:: + from sqlalchemy import Table + users = Table('users', metadata, autoload=True) To insert data you can use the `insert` method. We have to get a