[Checkins] SVN: Product.ZSQLAlchemy/trunk/README.txt
Andreas Jung
andreas at andreas-jung.com
Thu Feb 1 07:51:24 EST 2007
Log message for revision 72297:
Changed:
U Product.ZSQLAlchemy/trunk/README.txt
-=-
Modified: Product.ZSQLAlchemy/trunk/README.txt
===================================================================
--- Product.ZSQLAlchemy/trunk/README.txt 2007-02-01 12:16:50 UTC (rev 72296)
+++ Product.ZSQLAlchemy/trunk/README.txt 2007-02-01 12:51:23 UTC (rev 72297)
@@ -2,7 +2,10 @@
(C) 2007, ZOPYX Ltd & Co. KG
D-72070 Tuebingen, Germany
+www.zopyx.com, info at zopyx.com
+Written by Andreas Jung
+
ZSQLAlchemy is published under the Zope Public License 2.1 (ZPL 2.1)
@@ -13,11 +16,13 @@
with Zope applications. It basically acts like some kind of DA and cares
automatically about connection and transaction handling
-Limitation:
+Limitations:
+
- currently only supports Postgres through the psycopg2 Python bindings
for Postgres
+ - might not work properly from within untrusted code
Requirements:
@@ -29,5 +34,26 @@
- psycopg2 2.0.5
+Basic usage:
+ import sqlalchemy
+ def test(self):
+
+ zsqlalchemy = self.DA.getSession() # 'DA' is ZSQLAlchemy instance
+ session = zsqlalchemy.getSession() # obtain a session proxy
+ metadata = session.getMetaData() # obtain metadata instance
+
+ # auto load 'users' table from postgres
+ UsersTable = sqlalchemy.Table('users', metadata, autoload=True)
+
+ # select some data
+ s = UsersTable.select()
+ for row in s.execute():
+ print row
+
+ # insert some data
+ i = UsersTable.insert()
+ i.execute(firstname='foo', lastname='bar')
+
+ return 'done'
More information about the Checkins
mailing list