Exemplo n.º 1
0
from app import db, Products, Customers, Orders
db.create_all()

customer_1 = Customers(name='Iwan Moreton',
                       email='*****@*****.**',
                       house_number=2,
                       postcode='BB5 5BU')
customer_2 = Customers(name='First Last',
                       email='*****@*****.**',
                       house_number=2,
                       postcode='BB5 5BU')

db.session.add(customer_1)
db.session.add(customer_2)
db.session.commit()

product_1 = Products(title='Game 1', price=32.50, stock=1)
product_2 = Products(title='Game 2', price=35, stock=2)
db.session.add(product_1)
db.session.add(product_2)
db.session.commit()

order_1 = Orders(
    customer_id=Customers.query.filter_by(name='Iwan Moreton').first().id,
    product_id=Products.query.filter_by(title='Game 1').first().id)

order_2 = Orders(
    customer_id=Customers.query.filter_by(name='Iwan Moreton').first().id,
    product_id=Products.query.filter_by(title='Game 2').first().id)

order_3 = Orders(
Exemplo n.º 2
0
from app import db, Customers, Products, Orders

db.drop_all()
db.create_all()

customer_one = Customers(name="Dave", email="*****@*****.**")
customer_two = Customers(name="Tom", email="*****@*****.**")

product_one = Products(name="Laptop", price=499.99)
product_two = Products(name="tabletennis table", price=125.99)

order_one = Orders(customer=customer_one, product=product_one)
order_two = Orders(customer=customer_one, product=product_two)
order_three = Orders(customer=customer_two, product=product_one)

db.session.add(customer_one)
db.session.add(customer_two)
db.session.add(product_one)
db.session.add(product_two)
db.session.add(order_one)
db.session.add(order_two)
db.session.add(order_three)
db.session.commit()
Exemplo n.º 3
0
from app import db, Orders, Customers, Products

db.drop_all()
db.create_all()

ben = Customers(name='Ben', email='*****@*****.**')

phone = Products(name='Samsung 7', price=250.00)

db.session.add(ben)
db.session.add(phone)
db.session.commit()

order_phone = Orders(product_id=phone.id, customer_id=ben.id)

db.session.add(order_phone)
db.session.commit()
Exemplo n.º 4
0
from app import db, Customers, Products, Orders

db.create_all()  # Creates all table classes defined

customer_1 = Customers(
    name='Kiran',
    email='*****@*****.**',
)

phone1 = Products(name='OnePlus 6t', price=399.99)

db.session.add(customer_1)
db.session.add(phone1)
db.session.commit()
Exemplo n.º 5
0
from app import db, Customers

customerlist = [
    {
        'name': 'Vishal Bharathi',
        'email': '*****@*****.**',
        'current_balance': 500000
    },
    {
        'name': 'Rahul parghi',
        'email': '*****@*****.**',
        'current_balance': 300000
    },
    {
        'name': 'jaydeep chudasma',
        'email': '*****@*****.**',
        'current_balance': 100000
    },
]

for i in customerlist:
    new_customer = Customers()
    new_customer.name = i['name']
    new_customer.email = i['email']
    new_customer.current_balance = i['current_balance']
    db.session.add(new_customer)
    db.session.commit()

print("finished")
Exemplo n.º 6
0
from app import db, Orders, Customers, Products

db.create_all()

ross = Customers(name='Ross', email='*****@*****.**')

watch =

db.session.add(ross)
db.session.add(watch)
db.session.commit()
Exemplo n.º 7
0
from app import db, Customers, Products, Orders
db.drop_all()
db.create_all()  # Creates all table classes defined

customer_one = Customers(name="Abhyas", email='*****@*****.**')
customer_two = Customers(name="Frank", email="*****@*****.**")

product_one = Products(name="Laptop", price=499.99)
product_two = Products(name="Rickenbacker 4003", price=2300.0)

order_one = Orders(customer=customer_one, product=product_one)
order_one = Orders(customer=customer_one, product=product_two)
order_three = Orders(customer=customer_two, product=product_one)

db.session.add(customer_one)
db.session.add(customer_two)
db.session.add(product_one)
db.session.add(product_two)
db.session.add(order_one)
db.session.add(order_two)
db.session.add(order_three)
db.session.commit()
Exemplo n.º 8
0
from app import db, Customers, Products

db.create_all()

ben = Customers(first_name='Ben', last_name='Hesketh', email='*****@*****.**')

phone = Products(name='Samsung 7', price=250.00)

db.session.add(ben)
db.session.add(phone)
db.session.commit()

order_phone = Customers_products(product_id=phone.id, customer_id=ben.id)

db.session.add(order_phone)
db.session.commit()