On Feb 4, 2013, at 1:04 AM, ru...@yahoo.com wrote:

> simply didn't get from the docs.  Like the fact that I could
> create a mapped object simply with 
> 
>   class User: pass
> 
> rather than explicitly specifying all the attributes.  Without
> that I wouldn't even be trying to use sqlalchemy today.
Well, the majority of users who see "class User" and then the separate 
"mapper()" + "Table" step, which for many years was how we documented it, would 
lead new users to say, "what! that's so verbose!  I'm going back to Django 
where I can define everything inline".   So a lot more people weren't trying to 
use us on that side of things :)    Also, I personally found class + mapper() + 
Table to be unworkable in practice - declarative offers all kinds of advantages 
over the plain approach and greatly reduces boilerplate and redundancy.   Often 
I will keep the Table metadata explicit but just define it within the 
declarative class as such:

class SomeClass(Base):
    __table__ = Table('sometable', Base.metadata, 
                            Column(...), 
                            ...
                        )

that style is documented at 
http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/declarative.html#using-a-hybrid-approach-with-table
 .

The ORM tutorial is really quite carefully written, to make sure people are at 
least somewhat aware, as they are seeing SQLAlchemy ORM usage for the first 
time, that they are building upon a system that can be broken into smaller 
parts:

With our User class constructed via the Declarative system, we have defined 
information about our table, known as table metadata, as well as a user-defined 
class which is linked to this table, known as a mapped class. Declarative has 
provided for us a shorthand system for what in SQLAlchemy is called a 
“Classical Mapping”, which specifies these two units separately and is 
discussed in Classical Mappings. The table is actually represented by a 
datastructure known as Table, and the mapping represented by a Mapper object 
generated by a function called mapper(). Declarative performs both of these 
steps for us, making available the Table it has created via the __table__ 
attribute:

"Classical mappings"  is linked, you go there, and see the traditional mapping, 
a plain User class with nothing but a constructor.   The constructor is not 
needed and at the moment this appears to not be mentioned. 



>> > logging is fully described here:
>> > 
>> > http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html#configuring-logging
> Thanks.  Since logging applies to other parts of Sqlalchemy besides
> the engine, would it be better if this were in it own section?  Even
> if not, I think it would help if logging had a link in the table of 
> contents page (http://docs.sqlalchemy.org/en/rel_0_8/)
logging is really about the "Engine" and the "Pool", which is closely tied to 
the Engine.  Logging for other areas is being de-emphasized as it isn't 
generally used.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to