-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed_brands.py
216 lines (199 loc) · 7.61 KB
/
seed_brands.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
from model import Brand, db, connect_to_db
import csv
DB_URI = "http:///poultrywatch.db"
def seed_brand_info():
"""This is where we create the brand database:
class Brand(db.Model):
This the brand database for Walmart products in the category of Food:
__tablename__ = "brands"
brand_id = db.Column(db.Integer, autoincrement=True, primary_key=True)
brand_name = db.Column(db.String(64), nullable=False)
brand_website = db.Column(db.String(64), nullable=False)
brand_youtube = db.Column(db.String(64))
brand_instagram = db.Column(db.String(64))
brand_twitter = db.Column(db.String(64))
brand_google_plus = db.Column(db.String(64))
brand_conventional = db.Column(db.Boolean)
brand_organic = db.Column(db.Boolean)
brand_free_range = db.Column(db.Boolean)
brand_pastured = db.Column(db.Boolean)
as such"""
# def __init__(self, brand_name, brand_website, brand_youtube, brand_instagram,
# brand_twitter, brand_google_plus, brand_conventional, brand_organic, brand_free_range,
# brand_pastured)
brand_name_list = [
{"brand_name": "Great Value",
"parent_company": None,
"brand_website": "http://www.walmart.com/",
"brand_youtube": "https://www.youtube.com/user/Walmart",
"brand_instagram": "http://instagram.com/walmart",
"brand_facebook": "https://www.facebook.com/walmart?fref=nf",
"brand_twitter": "https://twitter.com/Walmart?",
"brand_google_plus": "http://google.com/+Walmart",
"brand_pintrest": "https://www.pinterest.com/walmart/",
"brand_conventional": True,
"brand_organic": False,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Tyson",
"parent_company": None,
"brand_website": "http://www.tysonfoods.com/",
"brand_youtube": "https://www.youtube.com/user/TysonCommunity",
"brand_instagram": "https://instagram.com/tysonfoods/",
"brand_facebook": "https://www.facebook.com/TysonFoods",
"brand_twitter": "https://twitter.com/tysonfoods",
"brand_google_plus": "https://plus.google.com/wm/1/+tysonfoods/posts",
"brand_pintrest": "https://www.pinterest.com/TysonFoods/",
"brand_conventional": True,
"brand_organic": False,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Swanson",
"parent_company": None,
"brand_website": "http://www.swansonchicken.com/",
"brand_youtube": "https://www.youtube.com/user/SwansonChicken",
"brand_instagram": "https://instagram.com/swansonbroths/",
"brand_facebook": "https://www.facebook.com/Swanson",
"brand_twitter": "https://twitter.com/swansonchicken",
"brand_google_plus": None,
"brand_pintrest": None,
"brand_conventional": True,
"brand_organic": True,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Valley Fresh",
"parent_company": "Hormel",
"brand_website": "www.valleyfresh.com/",
"brand_youtube": "https://www.youtube.com/channel/UCf25ENy1sRMV-Jm-YgV4LUA",
"brand_instagram": None,
"brand_facebook": None,
"brand_twitter": "https://twitter.com/hormelfoods",
"brand_google_plus": "https://plus.google.com/110089461772215972543",
"brand_pintrest": None,
"brand_conventional": True,
"brand_organic": True,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Hormel",
"parent_company": None,
"brand_website": "http://www.hormel.com/",
"brand_youtube": "https://www.youtube.com/user/HormelFoodsCorp",
"brand_instagram": "https://instagram.com/hormelfoods",
"brand_facebook": "https://www.facebook.com/Hormelrecipeasy",
"brand_twitter": "https://twitter.com/hormelfoods",
"brand_pintrest": "https://www.pinterest.com/recipeasyhormel/",
"brand_google_plus": "https://plus.google.com/110089461772215972543",
"brand_conventional": True,
"brand_organic": False,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Applegate",
"parent_company": "Hormel",
"brand_website": "http://www.applegate.com/",
"brand_youtube": "https://www.youtube.com/user/ApplegateFarms",
"brand_instagram": "http://instagram.com/applegate",
"brand_facebook": "https://www.facebook.com/applegate",
"brand_twitter": "https://twitter.com/Applegate",
"brand_pintrest": "http://www.pinterest.com/applegatefarms/",
"brand_google_plus": None,
"brand_conventional": True,
"brand_organic": True,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Perdue",
"parent_company": None,
"brand_website": "http://www.perdue.com/",
"brand_youtube": "https://www.youtube.com/user/PerdueChicken",
"brand_instagram": "https://instagram.com/p/vgdgfxRYTc/",
"brand_facebook": "https://www.facebook.com/PerdueChicken",
"brand_twitter": "https://twitter.com/perduechicken",
"brand_google_plus": "https://plus.google.com/+perduechicken",
"brand_pintrest": None,
"brand_conventional": True,
"brand_organic": False,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Banquet",
"parent_company": "Con Agra Foods",
"brand_website": "www.banquet.com/",
"brand_youtube": "https://www.youtube.com/user/FoodYouLove",
"brand_instagram": "https://instagram.com/conagrafoods/",
"brand_facebook": "https://www.facebook.com/ConAgraFoods",
"brand_twitter": "https://twitter.com/conagrafoods",
"brand_google_plus": "https://plus.google.com/101514143380306398233/about",
"brand_pintrest": None,
"brand_conventional": True,
"brand_organic": False,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Foster Farms",
"parent_company": None,
"brand_website": "www.fosterfarms.com/",
"brand_youtube": "https://www.youtube.com/user/FosterFarmsBrand",
"brand_instagram": None,
"brand_facebook": "https://www.facebook.com/FosterFarms",
"brand_twitter": "https://twitter.com/ffchicken",
"brand_google_plus": "https://plus.google.com/110873023933925073919/about",
"brand_pintrest": None,
"brand_conventional": True,
"brand_organic": True,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
{"brand_name": "Harvestland",
"parent_company": "Perdue",
"brand_website": "http://www.perdue.com/",
"brand_youtube": "https://www.youtube.com/user/PerdueChicken",
"brand_instagram": "https://instagram.com/p/vgdgfxRYTc/",
"brand_facebook": "https://www.facebook.com/PerdueChicken",
"brand_twitter": "https://twitter.com/perduechicken",
"brand_google_plus": "https://plus.google.com/+perduechicken",
"brand_pintrest": None,
"brand_conventional": False,
"brand_organic": True,
"brand_free_range": False,
"brand_pastured": False,
"slow_growth": False,
},
]
for dict_item in brand_name_list:
brand_table_values = Brand(
brand_name = dict_item['brand_name'],
parent_company = dict_item['parent_company'],
brand_website = dict_item['brand_website'],
brand_facebook = dict_item['brand_facebook'],
brand_youtube = dict_item['brand_youtube'],
brand_instagram = dict_item['brand_instagram'],
brand_twitter = dict_item['brand_twitter'],
brand_pintrest = dict_item['brand_pintrest'],
brand_google_plus = dict_item['brand_google_plus'],
brand_conventional = dict_item['brand_conventional'],
brand_organic = dict_item['brand_organic'],
brand_free_range = dict_item['brand_free_range'],
brand_pastured = dict_item['brand_pastured'],
brand_slow_growth = dict_item['slow_growth'])
db.session.add(brand_table_values)
db.session.commit()
# print type(brand_table_values) this is a class model.Brand
if __name__ == '__main__':
from server import app
connect_to_db(app)
print "Connected to DB."
seed_brand_info()