With 0.4 almost upon us, we're coming down to the wire for big changes
getting in- and some things are kind of "now or never".
I've found myself explaining engines and metadata with some particular
language lately, and I wondered, what would it look like to just put
that terminology in the names themselves? This is the last opportunity
for terminology changes for a while, so I offer this up for discussion.
So here's what I was thinking:
datasource = create_datasource('posgresql:///test')
connection = datasource.connect()
catalog = Catalog()
Table('foo', catalog, autoload=True)
catalog.bind = datasource
catalog.bind = 'sqlite:///'
Engines would be DataSources, and MetaData would be Catalogs.
I like the datasource name over engine because, from a user perspective,
engines don't "go"- there's no moving parts. Most of the time in
application code I think about these engines as URIs anyhow: Where is
this pointing? What database is that bound to? Which DB is that coming
from? The fact that it has a dialect, pool, etc., is just a given and
unimportant to me on the line. I just think about what I'm connecting
to or have connected. This is my mental translation:
# see
engine.connect()
# think
'mysql:///geocoding'.connnect()
...and I think a name change would help smooth out questions like 'how
do I organize my engine/engines in my code'. It feels natural to me as
well coming from other orms and pooling libraries.
I've been describing the metadata as a catalog for a bit now- "a catalog
of tables available in the database." There's something about the name
MetaData which, to me, is simultaneously vague and final. Like it's
very important, I don't really know what it does, and I should probably
only have one. In reality of course they're quite disposable and flexible.
So there you have it. I'm not married to this proposal by *any* means.
The ideas gelled in my brain during the SQLAlchemy tutorial at OSCON,
and this seems like the last opportunity to deeply question and
reconsider what we have before a new generation of users takes on
SQLAlchemy.
-j
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---