Michael Bayer wrote:
The ORM idea is interesting. we sort of have that now with the "using"
thing, but i see where youre going there. I dont have a strong
reaction to it yet, other than it would seriously rearrange things, and
also that the style might already be possible with some extensions that
wrap around mappers. Also I think SQLEngines are already a lot more
flexible than I think you are giving them credit for...my proposal tried
to address that. Keep in mind that Tables in fact only need a
SchemaEngine object, which is nothing more than a dictionary of Tables.
its analgous to a Table the way a Table is analgous to a Column; it is
its natural container (and you almost dont even need the SchemaEngine,
if you work with lexically-constructed TableClause objects). As far as
decoupling Schema/Engine, well maybe. ive thought a lot about that but
have yet to see how it doenst unnecessarily complicate the average use
case.
With regards to using just tables and SQL statements, without any
discussion about the ORM, is this what we're talking about ?
changing this:
t = Table('mytable', e, columns...)
t.select().execute()
to this:
t = Table('mytable', columns...)
something.get_connection().execute(t.select())
?
Yes. And it's fine if a table needs a Schema as its container. Just so the
schema doesn't tie the table to a particular engine. Although to complete the
analogy between Table and Column for Schema and Table it should be constructed
like this:
schema = Schema('myschema',
Table('table_1', columns...),
Table('table_2', columns...),
...
)
Just like a Column does not need a Table instance to be created, a Table does
not need a Schema instance to be created. Then tables would be referred to like
this:
schema.t.table_1.select(...)
s = schema.t
mapper_1 = mapper(Class1, s.table_1)
mapper_2 = mapper(Class2, s.table_2)
Also, create_engine(...) should require a schema object. So an engine has a
schema, not the other way around.
~ Daniel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users