Ian Bicking: the old part of his blog

Re: Sqlobject 2 comment 000

SQLAlchemy sql expressions are bound to an "engine" at creation time, but this is not any hard requirement, some sql expressions dont have an engine at all; you can send "None" for the engine just as easily. it was mostly just for convenience that a SQL expression has an engine at creation time, so you can just execute() it without specifying the engine each time.

When you want to compile the expression, thats when the engine is delivered; this engine instantiates a compiler object that is bound to a particular database's SQL grammar.

so SQLAlchemy sql expressions are totally standalone as well, though I perhaps didnt make that so clear in its construction. the same expression can be compiled over and over with different database engines to produce different results (though there are a few hacks in the oracle module right now that modify the original expression, those are on the list to be fixed).

also it didnt come across to me that you were thinking about SQL-API until I saw your blog post on it, at which point SQLAlchemy was already publically available via SVN. we are definitely experiencing some significant overlap in our work, but im not sure if thats really such a problem (better two code paths than butting heads over every small decision :) )

Comment on Sqlobject 2 comment 000
by mike bayer

Comments:

ok, I should correct myself, while the expressions are pretty much engine-agnostic, the table objects at the base of it are wired to a specific engine....which also is mostly so an individual Table instance can be a singleton against its name/schema name/database connection (sort of like a SQLObject class). there was the notion that the Table of different databases would have different behavior but this hasnt come to pass, except in the case of MySQL where you can specify the "table type", i.e. ISAM/InnoDB etc. if you want to make Table objects that are agnostic of any database there is a generic engine you can use; but that still binds the Table to a certain grammar.

So, I should probably think of a way to have not just SQL expressions but the Tables at the base of them to exist without a connection to any kind of lexical engine, since its close to that but not quite.

# mike bayer