Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python SQLAlchemy Basics Introduction to SQLAlchemy Creating a Movie Model

Hi Please could you help me get the right outcome for my code, i think i imported the column and integers wrong.

Your help would be much appreciated. I don't understand how my import is wrong for the column and integers

models.py
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('sqlite:///movies.db', echo=False)
Base = declarative_base()

class Movie(Base):
    __tablename__ = 'movies'

id = Column(Integer, primary_key=True)
movie_title = Column(String)
genre = Column(String)

1 Answer

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Hi! You don't need to import from sqlalchemy twice, you can do it all on one line from sqlalchemy import create_engine, Column, Integer, String

Thank you so much Megan Amendola that really helped a lot.