Пример #1
0
def set_up_sample_bom_files(number):
    while number:
        number -= 1
        bom = BomFile(
            name=name.first_name(), comment=lorem_ipsum.paragraph(sentences_quantity=3)
        )
        db.session.add(bom)

    db.session.commit()
Пример #2
0
	def generate_fake(count=75):
		from random import seed
		from forgery_py import name
		from sqlalchemy.exc import IntegrityError

		seed()
		for i in range(count):
			a = Author(first=name.first_name(), last=name.last_name())
			db.session.add(a)
			try:
				db.session.commit()
			except IntegrityError:
				db.session.rollback()
Пример #3
0
	def generate_fake(count=100):
		from sqlalchemy.exc import IntegrityError
		from random import seed
		from forgery_py import name, date, internet, address, personal
		
		seed()
		for i in range(count):
			p = Person(name.first_name(), name.last_name(), date.date(),
					   personal.gender(), address.phone(), internet.email_address(),
					   address.street_address(), address.city(), 
					   address.state_abbrev(), address.zip_code())
			db.session.add(p)

			try:
				db.session.commit()
			except IntegrityError:
				db.session.rollback()