from sqlalchemy import create_engine
from faker import Faker
import json, random
# make some fake data
fake = Faker()
products = []
for i in range(1, 11, 1):
products.append({
'name': 'Product {}'.format(i),
'description': fake.paragraph(),
'price': random.randint(1,10),
})
# prepare data to be inserted into db
rows = ["('{}', '{}', '{}')".format(i['name'], i['description'], i['price']) for i in products]
values = ','.join(rows)
# insert data into the db
db = create_engine("postgresql:///postscript")