def list_active_customers(): """ Returns an integer with the number of customers whose status is currently active. """ customer_count = Customer.select().where(Customer.status == True).count() LOGGER.info('%s customers are currently active', customer_count) return customer_count
def list_active_customers(): """ :param stage: :return: """ results_dict = Customer.select().where(Customer.status == True).dicts() return results_dict
def list_active_customers(stage='prod'): """ :param stage: :return: """ if stage == 'prod': results_dict = Customer.select().where(Customer.status is True).dicts() if stage == 'dev': results_dict = TestCustomer.select().where( TestCustomer.status is True).dicts() return results_dict
def return_all_customer_info(): """ Prints all customer info """ all_customer_records = Customer.select() for persion in all_customer_records: print( f"Customer id: {person.customer_id}\nFirst Name: {person.first_name}\nLast Name: {person.last_name}\n" f"Home Address: {person.home_address}\nPhone Number: {person.phone_number}\n" f"Email Address: {person.email_address}\nStatus: {person.status}\nCredit Limit: ${person.credit_limit}\n" ) if __name__ == "__main__": cc.main() search_customer("W3434fd") list_active_customers()
def list_active_customers(): """ :return: This function will return an integer with the number of customers whose status is currently active. """ try: database.connect() database.execute_sql('PRAGMA foreign_keys = ON;') with database.transaction(): for customer in cls_Customer.select().where( cls_Customer.status == 1): logger.info( f'customers whose first name is {customer.first_name} current status is active' ) except Exception as e: logger.info('there could be no active ') logger.info(e) finally: logger.info('database closes') database.close()
def get_customers_record_count(): return Customer.select().count()
def list_active_customers(): list_customers = Customer.select().where(Customer.status == 1) return list_customers.count()
def list_active_customers(): #import pdb;pdb.set_trace() list_customers = Customer.select().where(Customer.status == True) return list_customers.count()