-
Notifications
You must be signed in to change notification settings - Fork 2
/
seeds.py
361 lines (305 loc) · 13.7 KB
/
seeds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
from email.policy import default
from app.db import Session, Base, engine
from app.models import Book, Author, Review, User
# Drop and rebuild tables
Base.metadata.drop_all(engine)
Base.metadata.create_all(engine)
db = Session()
# Insert users
db.add_all([
User(name="Fernando",
username="fernandosantamarta",
email="[email protected]",
home_address="123 SW 56 Street",
password="test123"),
User(name="Sasha",
username="thedinoinstitute",
email="[email protected]",
home_address="354 NW 44 Street",
password="test123"),
User(name="Thamare",
username="Thamare1",
email="[email protected]",
home_address="789 SW 22 Street",
password="test123"),
User(name="Karim",
username="AbdulJabaar",
email="[email protected]",
home_address="555 NW 10 Street",
password="test123"),
User(name="Sebastian",
username="cheesecakeassassin",
email="[email protected]",
home_address="965 SW 30 Street",
password="test123"),
User(name="Camilo",
username="puesyo",
email="[email protected]",
home_address="523 NW 16 Street",
password="test123")
])
db.commit()
# Insert reviews
#TODO: Fix for future, not for presentation
db.commit()
# Insert books
db.add_all([
Book(title="Little Women",
author="Louisa May Alcott",
isbn=9781593081089,
publisher="Barnes & Noble",
genre="Literature",
price=8.95,
year_published=2009,
description="Generations of readers young and old, male and female, have fallen in love with Little Women",
sold_copies=3000),
Book(title="Frankenstein",
author="Mary Shelley",
isbn=9780143131847,
publisher="Penguin Publishing Group",
genre="Literature",
price=8.95,
year_published=2018,
description="Mary Shelley's seminal novel of the scientist whose creation becomes a monster.",
sold_copies=250),
Book(title="The Picture of Dorian Gray",
author="Oscar Wilde",
isbn=9781593080259,
publisher="Barnes & Noble",
genre="Literature",
price=7.95,
year_published=2003,
description="Oscar Wilde brings his enormous gifts for astute social observation and sparkling prose to The Picture of Dorian Gray",
sold_copies=3100),
Book(title="Wuthering Heights",
author="Emily Bronte",
isbn=9780141439556,
publisher="Penguin Publishing Group",
genre="Fiction",
price=7.95,
year_published=2002,
description="Wuthering Heights is a wild, passionate story of the intense and almost demonic love.",
sold_copies=1000),
Book(title="Treasure Island",
author="Robert Louis Stevenson",
isbn=9781593082475,
publisher="Barnes & Noble",
genre="Adventure",
price=7.95,
year_published=2005,
description="The most popular pirate story ever written in English, featuring one of literature's most beloved.",
sold_copies=800),
Book(title="Fahrenheit 451: A Novel",
author="Ray Bradbury",
isbn=9781451673319,
publisher="Simon & Schuster",
genre="Literature",
price=13.99,
description="Guy Montag is a fireman. His job is to destroy the most illegal of commodities, the printed book.",
year_published=2012,
sold_copies=1500),
Book(title="Alice's Adventures in Wonderland & Through The Looking Glass",
author="Lewis Carroll",
isbn=9781533653697,
publisher="CreateSpace Publishing",
genre="Childrens",
price=12.0,
year_published=2016,
description="The young Alice is bored in a too conventional world. But here goes a White Rabbit.",
sold_copies=900),
Book(title="Peter Pan",
author="J.M.Barrie",
isbn=9780805072457,
publisher="Henry Holt and Co.",
genre="Childrens",
price=7.99,
year_published=2003,
description="Peter Pan, the mischievous boy who refuses to grow up.",
sold_copies=2300),
Book(title="A Wrinkle in Time",
author="Madeleine L'Engle",
isbn=9780312367541,
publisher="Square Fish",
genre="Childrens",
price=6.99,
year_published=2007,
description="Out of this wild night, a strange visitor comes to the Murry house and beckons Meg.",
sold_copies=1350),
Book(title="The Wizard of Oz",
author="L. Frank Baum",
isbn=9780141321028,
publisher="Penguin Publishing Group",
genre="Childrens",
price=7.99,
year_published=2008,
description="Dorothy thinks she is lost forever when a terrifying tornado crashes through Kansas.",
sold_copies=3600),
Book(title="The Secret of the Old Clock (Nancy Drew Mystery Stories #1)",
author="Carolyn Keene",
isbn=9780448095011,
publisher="Applewood Books",
genre="Childrens",
price=8.99,
year_published=1991,
description="Nancy, unaided, seeks to find a missing will.",
sold_copies=750),
Book(title="In Cold Blood",
author="Truman Capote",
isbn=9780679745587,
publisher="Knopf Doubleday Publishing Group",
genre="True), Crime",
price=14.95,
year_published=1994,
description="On November 15, 1959, in the small town of Holcomb, Kansas, four members of the Clutter family were savagely murdered.",
sold_copies=1200),
Book(title="The Devil in the White City",
author="Erik Larson",
isbn=9780609608449,
publisher="Crown Publishers",
genre="True), Crime",
price=14.95,
year_published=1994,
description="Two men, each handsome and unusually adept at his chosen work, embodied an element of the great dynamic.",
sold_copies=4000),
Book(title="Helter Skelter: The True), Story of the Manson Murders",
author="Vincent Bugliosi, Curt Gentry",
isbn=9780393322231,
publisher="W.W. Norton ny",
genre="True), Crime",
price=14.49,
year_published=2001,
description="In the summer of 1969, in Los Angeles, a series of brutal, seemingly random murders captured headlines across America.",
sold_copies=2700),
Book(title="Zodiac: The Shocking True)",
author="Robert Graysmith",
isbn=9780425212189,
publisher="Penguin Publishing Group",
genre="True), Crime",
price=8.99,
year_published=2007,
description="A sexual sadist, the Zodiac killer took pleasure in torture and murder. His first victims were a teenage couple.",
sold_copies=3200),
Book(title="The Road to Jonestown: Jim Jones and Peoples Temple",
author="Jeff Guinn",
isbn=9781476763835,
publisher="Simon & Schuster",
genre="True), Crime",
price=15.99,
year_published=2018,
description="In the 1950s, a young Indianapolis minister named Jim Jones preached a curious blend of the gospel and Marxism.",
sold_copies=1800),
Book(title="The Talented Mr. Ripley",
author="Patricia Highsmith",
isbn=9780393332148,
publisher="W.W. Norton ny",
genre="Thriller",
price=12.95,
year_published=2008,
description="Since his debut in 1955, Tom Ripley has evolved into the ultimate bad boy sociopath.",
sold_copies=1500),
Book(title="Murder on the Orient Express",
author="Agatha Christie",
isbn=9780007119318,
publisher="HarperCollins",
genre="Thriller",
price=8.99,
year_published=2007,
description="Just after midnight, a snowdrift stops the Orient Express in its tracks as it travels through the mountainous Balkans.",
sold_copies=900),
Book(title="The Shining",
author="Stephen King",
isbn=9780450040184,
publisher="New English Library",
genre="Thriller",
price=14.99,
year_published=1980,
description="Jack Torrance's new job at the Overlook Hotel is the perfect chance for a fresh start.",
sold_copies=3400),
Book(title="Gone Girl",
author="Gillian Flynn",
isbn=9780307588371,
publisher="Random House Publishing Group",
genre="Thriller",
price=14.99,
year_published=2014,
description="On a warm summer morning in North Carthage, Missouri, it is Nick and Amy Dunne’s fifth wedding anniversary.",
sold_copies=1700),
Book(title="The Silence of Lambs",
author="Thomas Harris",
isbn=9780312924584,
publisher="St. Martin's Publishing Group",
genre="Thriller",
price=8.99,
year_published=1991,
description="Hannibal Lecter. The ultimate villain of modern fiction. Read the five-million-copy bestseller that scared the world silent.",
sold_copies=1250)
])
db.commit()
# Insert authors
db.add_all([
Author(name="Louisa May Alcott",
biography="Louisa May Alcott was born in Germantown, Pennsylvania on November 29, 1832. She and her three sisters, Anna, Elizabeth.",
publisher="Barnes & Noble"),
Author(name="Mary Shelley",
biography="Mary Shelley was an English novelist, short story writer, dramatist, essayist, biographer, travel writer.",
publisher="Penguin Publishing Group"),
Author(name="Oscar Wilde",
biography="Oscar Fingal O'Flahertie Wills Wilde was an Irish playwright, poet, and author of numerous short stories.",
publisher="Barnes & Noble"),
Author(name="Emily Bronte",
biography="Emily Jane Brontë was a British novelist and poet, now best remembered for her only novel Wuthering Heights.",
publisher="Penguin Publishing Group"),
Author(name="Robert Louis Stevenson",
biography="Robert Louis Balfour Stevenson was a Scottish novelist, poet, and travel writer, and a leading representative.",
publisher="Barnes & Noble"),
Author(name="Ray Bradbury",
biography="Ray Douglas Bradbury, American novelist, short story writer, essayist, playwright, screenwriter and poet.",
publisher="Simon & Schuster"),
Author(name="Lewis Carroll",
biography="The Reverend Charles Lutwidge Dodgson, better known by the pen name Lewis Carroll, was an English author.",
publisher="CreateSpace Publishing"),
Author(name="J.M. Barrie",
biography="Sir James Matthew Barrie, 1st Baronet, OM was a Scottish author and dramatist, best remembered today as the creator. of Peter Pan.",
publisher="Henry Holt and Co."),
Author(name="Madeleine L'Engle",
biography="Madeleine L'Engle was an American writer best known for her young adult fiction, particularly the Newbery Medal-winning.",
publisher="Square Fish"),
Author(name="L. Frank Baum",
biography="Lyman Frank Baum was an American author, actor, and independent filmmaker best known as the creator, along with illustrator.",
publisher="Penguin Publishing Group"),
Author(name="Carolyn Keene",
biography="Carolyn Keene is a writer pen name that was used by many different people- both men and women- over the years.",
publisher="Applewood Books"),
Author(name="Truman Capote",
biography="Truman Capote was an American writer whose non-fiction, stories, novels and plays are recognised literary classics.",
publisher="Knopf Doubleday Publishing Group"),
Author(name="Erik Larson",
biography="Erik is a former features writer for The Wall Street Journal and Time. His magazine stories have appeared in The New Yorker.",
publisher="Crown Publishers"),
Author(name="Vincent Bugliosi, Curt Gentry",
biography="American attorney and author, best known for prosecuting Charles Manson and his followers for the murder of Sharon Tate.",
publisher="W.W. Norton Company"),
Author(name="Robert Graysmith",
biography="ROBERT GRAYSMITH is the New York Times Bestselling author and illustrator of Zodiac , Auto Focus , and Black Fire.",
publisher="Penguin Publishing Group"),
Author(name="Jeff Guinn",
biography="Jeff Guinn is a former journalist, who has won national, regional and state awards for investigative reporting.",
publisher="Simon & Schuster"),
Author(name="Patricia Highsmith",
biography="Patricia Highsmith was an American novelist who is known mainly for her psychological crime thrillers.",
publisher="W.W. Norton Company"),
Author(name="Agatha Christie",
biography="Agatha Christie is the best-selling author of all time. She wrote 66 crime novels and story collections.",
publisher="HarperCollins"),
Author(name="Stephen King",
biography="Stephen Edwin King (born September 21, 1947) is an American author of horror, supernatural fiction, suspense.",
publisher="New English Library"),
Author(name="Gillian Flynn",
biography="Gillian Flynn is an American author and television critic for Entertainment Weekly. She has so far written.",
publisher="Random House Publishing Group"),
Author(name="Thomas Harris",
biography="Gillian Flynn is an American author and television critic for Entertainment Weekly. She has so far written.",
publisher="St. Martin's Publishing Group")
])
db.commit()
db.close()