Hi Todd,

Nice to know you got it working.

On Tue, Jan 5, 2010 at 5:33 AM, Todd Blanchard <[email protected]> wrote:
>
> I guess I need to do say
> from eagle.model import DeclarativeBase, metadata, DBSession
> instead of calling declarative_base()

Yes ofcourse, because the default metadata object is obtained from that.

> -Todd Blanchard
> On Jan 4, 2010, at 3:39 PM, Todd Blanchard wrote:
>
> First, defining the models in __init__.py is poor practice, so why does the
> tutorial do it?  It should describe how to create a separate models.py file.

It was done with an intention to make the example minimalistic for someone
who first wants to get the application up and running quickly.

> Second - and this is my biggest pet peeve since coming to the python world -
> when writing a tutorial for the love of god please INCLUDE THE IMPORT
> STATEMENTS.  Really, I spend more time grepping for how to import stuff than
> anything else in python.

I thought I included all the import statements additional to those
already included
in the quickstart files. I am sorry if I missed any. Could you point
that out please.

thanks
Sanjiv

> OK, I feel better now.
> I'm trying to follow the feature server tutorial and I find that running
> paster setup-app does not generate my tables.  It makes the user tables and
> security stuff ,but the not the roads table.
> I defined models.py and put this in it:
> from sqlalchemy.ext.declarative import declarative_base
> from sqlalchemy.orm import relation, backref
> from sqlalchemy import Column, Integer, Unicode, DateTime, ForeignKey
> from geoalchemy import GeometryColumn, Point
> from geoalchemy import GeometryDDL
> from datetime   import datetime
> DeclarativeBase = declarative_base()
> class Road(DeclarativeBase):
>     __tablename__ = 'roads'
>     id = Column(Integer, primary_key=True)
>     name = Column(Unicode, nullable=False)
>     width = Column(Integer)
>     created = Column(DateTime, default=datetime.now())
>     geom = GeometryColumn(LineString(2))
> GeometryDDL(Road.__table__)
> Then in __init__.py I added the line at the bottom:
> from eagle.model.models import Road
> Running paster setup-app development.ini generates all the user/groups
> tables as expected but it does not create the 'roads' table.
> Why not?
> Thanks,
> -Todd Blanchard
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "TurboGears" 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?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "TurboGears" 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?hl=en.
>

--

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


Reply via email to