def importToSupplier(): try: dsnStr = cx_Oracle.makedsn("217.173.198.135", "1522", "orcltp") con = cx_Oracle.connect(user="******", password="******", dsn=dsnStr) num = int(input("How many rows should be entered? ")) last_id = getLastID("supplier") print("Fetching rows...") for x in range(num): a = mimesis.Address('en') p = mimesis.Person('en') b = mimesis.Business('en') address = a.city() name = b.company() print(name) contact_person = p.full_name() phone = p.telephone() email = p.email(domains=['mail.com']) query = "INSERT INTO supplier (id_supplier, address, name, contact_person, phone, email) VALUES (:1, :2, " \ ":3, :4, :5, :6) " cursor = con.cursor() last_id = last_id + 1 cursor.execute( query, (last_id, address, name, contact_person, phone, email)) print(query) cursor.close() con.commit() print("Rows added successfully") except cx_Oracle.Error as error: print("Error occurred:") print(error) consoleInput()
def create_company(save=False): company = edgewise.new_doc("Company") company.name = mimesis.Person("en").last_name() + " "\ + mimesis.Business().company_type(abbr=True) company.country = "United States" if save: company.save() return company
def seed(): business = mimesis.Business() datetime = mimesis.Datetime() text = mimesis.Text() default_checkout_fields = ["First Name", "Last Name"] distributors = models.Distributor.query.all() for distributor in distributors: campaign = models.Campaign( name=f"{business.company()} Distributor - {distributor.id}", company_name=f"Campaign distributor {distributor.id}", start_date=datetime.datetime(start=2018, end=2019), end_date=datetime.datetime(start=2020, end=2021), storefront_pricing=random.choice((True, False)), company_allowance=random.randrange(30, 200), company_allowance_personal_pay=random.choice((True, False)), items_count_limit=1000, price_limit=10000, email_shopper=random.choice((True, False)), checkout_fields=default_checkout_fields, departments=None, managers=None, message=text.sentence(), bfl_cost=0.0, distributor_po=None, pick_pack_partner_message=text.sentence(), created_by_id= 1, # we must specify this manually, since no user is logged in pick_pack_partner=None, distributor=distributor, ) db.session.add(campaign) shopper_role = models.Role.query.filter_by(name="Shopper").first() admin_buyer_role = models.Role.query.filter_by( name="Admin Buyer").first() # swap the existing shopper account over to this campaign shopper = models.Account.query.filter_by( distributor_id=distributor.id, role=shopper_role).first() shopper.distributor = None shopper.campaign = campaign db.session.add(shopper) # swap the existing admin buyer account over to this campaign admin_buyer = models.Account.query.filter_by( distributor_id=distributor.id, role=admin_buyer_role).first() admin_buyer.distributor = None admin_buyer.campaign = campaign admin_buyer.reports_enabled = True db.session.add(admin_buyer) db.session.commit()
def seed(): address = mimesis.Address() business = mimesis.Business() person = mimesis.Person() for _ in range(1, 6): distributor = models.Distributor( name=business.company(), email=person.email(), address=address.address(), campaign_cost=random.uniform(0, 10), max_sales_count=random.uniform(2, 10), ow_cost=random.uniform(0, 10), ) db.session.add(distributor) db.session.commit()
def seed(): address = mimesis.Address() business = mimesis.Business() person = mimesis.Person() vendor_types = [ { "is_supplier": True }, { "is_decorator": True }, { "is_pick_pack": True }, { "is_supplier": True, "is_pick_pack": True }, { "is_decorator": True, "is_pick_pack": True }, ] product_types = models.ProductType.query.all() # create five vendors for each product type for product_type in product_types: for vendor_type in vendor_types: vendor = models.Vendor( name=f"{address.state()} {business.company()}", email=person.email(), address=address.address(), **vendor_type, ) product_type.vendors.append(vendor) db.session.add(vendor) db.session.add(product_type) db.session.commit()
def business(request): return mimesis.Business(request.param)
outfile = config["customers"]["outfile"] outsize = config["customers"]["total"] max_age = config["customers"]["max_age"] min_age = config["customers"]["min_age"] joined_start_date = config["customers"]["joined_start_date"] joined_end_date = config["customers"]["joined_end_date"] genders = config["genders"][language] gender_prob = config["genders"]["percentages"] # data processing config amounts_cpu = config["data_processing"]["amount_in_cpu"] auto_batch = True if config["data_processing"][ "auto_batch_based_in_cpu"] == "True" else False # loading mocking data type business = mimesis.Business(language) person = mimesis.Person(language) address = mimesis.Address(language) dates = mimesis.Datetime(language) # Calculating random probabilities # 245 countries country_prob = common_functions.random_probabilities(1, 245) ages_probab = common_functions.random_probabilities(min_age, max_age) # Global customers array customers = [] def generate_customers(amount, index_start): # generates customers' info
def _companytype(): return mimesis.Business().company_type()
def _company(): return mimesis.Business().company()
def _business(): return mimesis.Business()