Python for Entrepreneurs Transcripts
Chapter: User accounts and identity
Lecture: Demo: Account table creation

Login or purchase this course to watch this video and the rest of the course contents.
0:01 We have an account class but we don't have an account table.
0:04 Now remember, all we should have to do is run this app,
0:08 it will know what derives from this, it's SqlAlchemyBase
0:12 and it's going to add the table, remember if the table exists, it won't update it,
0:16 but if it doesn't exist it will create it.
0:19 But it's not going to work, I want to just remind you why.
0:22 Run this, OK, it looks like it's running, fantastic, if we refresh and- no,
0:28 let's go back over here to our db session, remember this business,
0:32 where we had to import these things,
0:34 well, we need to do that again, and for account.
0:38 Now if I run it, what this is doing is making sure we have that
0:42 before we call create_all on our SqlAlchemyBase,
0:45 the SqlAlchemyBase has seen the account, so run that again,
0:49 over here, a little refresh.
0:52 Yay, we have an account class with all the things we'd like.
0:56 We have our text id, we have our email with the uniqueness,
0:59 with the constraint, and with an index,
1:02 and some constraints over here as well.