-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all,
I've just started looking at SQLAlchemy for use with GNU Mailman 2.2 (currently under development). I'm starting with trying to implement the MemberAdaptor API using a SQLAlchemy backend, and while initially it has seemed fairly simple, I've run into a few issues that I can't work around yet. I'm using a SQLite URL, but I can't seem to craft the URL to get the database file to end up in the file I want. For example, say I have Mailman installed in /usr/local/mailman. I want each mailing list to have its own members database and say I have a list named '[EMAIL PROTECTED]'. I want the database file to end up here: /usr/local/mailman/lists/[EMAIL PROTECTED]/members.db so my url is: sqlite:////usr/local/mailman/lists/[EMAIL PROTECTED]/members.db (note the 4 slashes -- I've read some of this list's archives) However, the members.db always ends up in /usr/local/mailman/ members.db, which is the pwd that I'm running my tests in. I've verified that it always creates members.db in the cwd. Is it the '@' in the url that's screwing things up? The next problem I'm having is how to organize the mapper and metadata for my application. What I want is a separate db file per mailing list, so I had thought that each mlist would get its own bound metadata, and I would define the Table in terms of that mlist- specific metadata. Then I'd create the table and a mapper between my application class and the table. However, as soon as I create the mapper I get this exception: ArgumentError: Class '<class 'Mailman.SAMemberships.Member'>' already has a primary mapper defined. Use is_primary=True to assign a new primary mapper to the class, or use non_primary=True to create a non primary Mapper But I don't think I want non-primary mappers here. I'm not sure what to do because the table passed to mapper() is bound to a metadata that is bound to the mlist-specific url. I'm not quite sure how to arrange things so that I have a session/metadata per mlist. Is there a way to create the table only if it doesn't yet exist, or to query whether the table exists? Currently I have to wrap my table.create() call in a try/except to throw away the OperationalError that gets thrown when I try to create the table that already exists. Finally (although I reserve the right to ask more questions later :), there seems to be a problem with the way I want to do transactions. For example, let's say I have a Members class and I create a new Member instance, then call session.save(new_member). Until I flush the session I can't issue a query that will return me that same Member instance. That makes sense. However when I add a new member, that is not my transaction boundary, so I don't want those changes written permanently to the database. I'm hoping that nested transactions will do the trick, IOW, create a transaction at my natural boundary, flush the session to write a subtransaction, then at my natural boundary, commit the outer transaction to permanently write the data to the database. I haven't actually gotten far enough to see if this will work with a SQLite backend, but perhaps you can provide some insight here. I think that's all for now. SQLAlchemy looks very promising, if I can work out these issues. Thanks, - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iQCVAwUBRKvv7nEjvBPtnXfVAQLHsgP/YPLcnBq1fFyeIjTfILTXPJRAfIw9zOvJ 4YLweE476WY6kb+4ItS2dLqtKWcKQo0GCtm6TdASpW2XX4qsqc0olQq3lvCBW/Qc fxQ6DPtP/V5rUqdpiNngnRfw2I8Mg+9hXWIh3wj5M2HSHiAvReg3r3fTYR0MtVPi qyScHoHh05Y= =UvEJ -----END PGP SIGNATURE----- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users