One of the things I struggle with as a newcomer to Python from Java, is if 
I import a class from a namespace, I expect to find the code in that 
namespace.
But I find namespace A includes namespace B, so you are forever chasing 
around in IDE's to get your head around the structures..
Case in point:
sel = select([Jobmst.jobmst_id, Jobmst.jobmst_name, Jobmst.jobmst_prntid, 
Jobmst.jobmst_type])
j2 = aliased(sel, name='j2')
j3 = aliased(Jobmst, name='j3')
print ('j2 type: ', type(j2))
print ('j3 type: ', type(j3))

j2 type:  <class 'sqlalchemy.sql.selectable.Alias'>
j3 type:  <class 'sqlalchemy.orm.util.AliasedClass'>

I had a
from sqlalchemy.sql import select


When I look in that I see Selectable comes from
.expression.Selectable

I use the docs and find this 
<http://docs.sqlalchemy.org/en/latest/core/selectable.html?highlight=expression%20selectable#sqlalchemy.sql.expression.Selectable>
Says. Bases: sqlAlchemy.sqlexpression.ClauseElement



http://docs.sqlalchemy.org/en/latest/orm/query.html?highlight=aliasedclass#sqlalchemy.orm.util.AliasedClass

Says AliasedClass is ORM equivalent of sqlalchemy.sql.expression.alias()
... maintains a reference to 'real' Alias object
usage via orm.aliased(). orm.with_polymorphic()


Alias -> sql.sqlexpression.Alias
bases sqlalchmy.sql.expression.FromClause

http://docs.sqlalchemy.org/en/latest/core/selectable.html#sqlalchemy.sql.expression.Alias

My this point i'm totally confused. I wanted to ensure j2 or j3 were 
interchangeable.
But without a big picture diagram I'm totally confused!

Is there such a diagram somewhere with the current 1.2 release please?

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to