hello,

I just started to use sqlalchemy in my pylons project.
I liked the declarative syntax of table definition rather than adding
mappers.

But now I am confused.
When I read the official sqlalchemy docs, they say that I don't need to
create the metadata instance because the base instance will have its own
metadata and session.
But in pylons the session and metadata get configured and instantiated
inside the model/meta module.

The following 2 lines of code are the source of my confusion.
from sqlalchemy.ext.declarative import declarative_base
base = declarative_base()

I believe the base instance here will have its own session and metadata
objects?
And how do I access the tables created using this approach?
Should I create the instances using model.class_name.__table__ or is
there another approach?
further more, I see that the Session.commit does not work, naturally
because it is not associated with any table instances using declarative
syntax.
Just as a guess, should the following 2 lines work with some correction?


from sqlalchemy.ext.declarative import declarative_base
base = declarative_base(meta.metadata)

if Yes then how can I create instances of any table inside a control?

I would awaite any guidance on this.
Happy ahcking.
Krishnakant.




--

You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.


Reply via email to