Skip to content

Instantly share code, notes, and snippets.

@infinite-Joy
Created June 14, 2017 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infinite-Joy/1aaade7f2f7c07c818c0917e5404277b to your computer and use it in GitHub Desktop.
Save infinite-Joy/1aaade7f2f7c07c818c0917e5404277b to your computer and use it in GitHub Desktop.
myFactory = Faker()
Session = sessionmaker(bind=mysql_engine)
session = Session()
billing_type_list = ['cheque', 'cash', 'credit', 'debit', 'e-wallet']
language = ['English', 'Bengali', 'Kannada']
operating_system = 'linux'
for i in range(60000, 1000000):
transaction = Transactions(
id = int(i),
name = myFactory.name(),
description = myFactory.text(),
country_name = myFactory.country(),
city_name = myFactory.city(),
cost = str(myFactory.random_digit_not_null()),
currency = myFactory.currency_code(),
created_at = myFactory.date_time_between(start_date="-30y", end_date="now", tzinfo=None),
billing_type = random.choice(billing_type_list),
language = random.choice(language),
operating_system = operating_system
)
session.add(transaction)
session.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment