Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Using Databases in Python Meet Peewee Modeling

Yuda Leh
Yuda Leh
7,618 Points

Any good tutorial to set up MySQL on computer so we don't have to use Workspaces?

Any good tutorial to set up MySQL on computer so we don't have to use Workspaces?

1 Answer

Ryan S
Ryan S
27,275 Points

Hi Yuda,

If you haven't taken the Database Foundations course yet then I would strongly suggest that you do. They go through it step by step on how to install, setup and run MySQL. I think it takes about 5 hours but it is well worth it, especially before starting the Python Databases course. But if you have an understanding of databases already then you could just skip to the installation and setup part.

One thing I will mention is that is possible (and fairly straightforward) to just jump into using SQLite, like Kenneth does in the course. It comes with the Python standard library and you should be able to follow along on your local machine without having to install anything extra.

Good luck.

Yuda Leh
Yuda Leh
7,618 Points

Don't I need to install something to be able to run the SQLite on my computer? I have sqlite3 on my mac but when I run the python file it says that peewee isn't found, I did the pip install peewee and it says that it is installed on my computer so I thought it was because I don't have an SQLite database.

EDIT: Fixed I did a quick search and I needed to do 'pip3 install peewee'.

Ryan S
Ryan S
27,275 Points

Hmm. That is strange. It sounds like it is an issue with peewee, not SQLite.

And you imported * from peewee at the top of your file?

There seems to be a bit of confusion on this subject. I know that when I was using SQLite for the Flask course, I didn't need to install anything related to SQLite. I just followed along with the videos and everything worked. (I'm using Python 3.5 on Windows). However, I used MySQL for the Python Databases course.

But if you check the documentation, it suggests importing sqlite3 at the top of your file. But then it requires a slightly different method to connect and create a database than what Kenneth is doing. I'm a bit confused myself on this since I was able to get it to work without doing that.

But again it sounds like there is an issue with peewee. Would you be able to post the entire error you are getting?