#801: 0.9a5 - sqlalchemy quickstart model.py template incorrect
--------------------------------+-------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone:
Component: Installation | Version: 0.9a5
Severity: normal | Resolution:
Keywords: |
--------------------------------+-------------------------------------------
Comment (by anonymous):
re:
{{{
i don't think that sqlalchemy can support automagic table creation from
mapped classes ( i checked the docs ). I think tables must be explicitly
generated via the Table() class instantiation , as created for user_group
and group_permission
}}}
I was wrong. It does, its just not documented well. The sytax to do so
is correct in savisit.py
{{{
TG_Visit.table.create()
}}}
however since ActiveMapper is in flux, the class/table definition needs
some altering to work
{{{
tbl__tgvisit = Table('tg_visit', __engine__,
Column('visit_key', String(40) , primary_key=True),
Column('created', DateTime , nullable = False ),
Column('expiry', DateTime ),
)
class TG_Visit(object):
table = tbl__tgvisit
def lookup_visit( cls, visit_key ):
return TG_Visit.get( visit_key );
lookup_visit= classmethod(lookup_visit)
assign_mapper( TG_Visit , tbl__tgvisit )
}}}
not pretty and uses the monkeypatch in sqlalchemy, but it keeps all the
rest of the code happy
also
saprovider.py is only half-ported to use the model.py classes. i'm 1/2way
through a patch.. should be done shortly.
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/801>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---