forked from S-Dey/Udacity-Item-Catalog-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
115 additions
and
39 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from database_setup import User, Base, Item, Category | ||
from sqlalchemy.orm import sessionmaker | ||
from sqlalchemy import create_engine | ||
|
||
|
||
engine = create_engine('sqlite:///itemcatalog.db', | ||
connect_args={'check_same_thread': False}) | ||
|
||
# Bind the above engine to a session. | ||
Session = sessionmaker(bind=engine) | ||
|
||
# Create a Session object. | ||
session = Session() | ||
|
||
user1 = User( | ||
name='Subhadeep', | ||
email='[email protected]', | ||
picture='https://img.com/sdf' | ||
) | ||
|
||
session.add(user1) | ||
session.commit() | ||
|
||
category1 = Category( | ||
name='Snowboarding', | ||
user=user1 | ||
) | ||
|
||
session.add(category1) | ||
session.commit() | ||
|
||
item1 = Item( | ||
name='Snowboard', | ||
description='It is an exciting snowboard. You will feel like in heaven after driving it!', | ||
category=category1, | ||
user=user1 | ||
) | ||
|
||
session.add(item1) | ||
session.commit() | ||
|
||
print('Finished populating the database!') |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters