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

What does .create do in python?

In the CRUD Create A Function problem, the solution requires calling on Challenge.create. What exactly does Challenge.create do?

https://teamtreehouse.com/library/using-databases-in-python/gettin-crudy-with-it/crud-create-function

Thanks

1 Answer

The .create() function is part of Peewee, not part of Python itself, so you have to import Peewee to be able to use it.

What .create() does is creates a new row (just a new, separate unit of data containing something that you specify) in the database that can be accessed or manipulated later. Here's the reference material from Peewee's API if you want to look into .create() a little more.

I was looking in the python documentation. No wonder I couldn't find it.

Thanks for your help.