def basic_report(): report = BasicReport(report_title='Basic Report Sample') report.build_file() report.create_worksheet_from_query( sheet_name='Sheet1', query={'filename': 'sample_query'} ) report.to_recipients.append(config['Default']['notification_recipient']) report.subject = 'Sample Report - Basic' report.message = 'Please see attached for the Basic Sample Report.' report.execute()
def runnit(): report = BasicReport(report_title='Subfolder Nested DAG') report.build_file() report.create_worksheet_from_query(sheet_name='Sheet1', query={'filename': 'missing_items'}) report.subject = "Report: Missing Items" report.message = """Good morning, Attached is a list of missing items. Thanks! Sincerely, report""" report.execute() return "success!"
def main(): report = BasicReport(report_title="US Geography - This One Doesn't Work") report.build_file() report.create_worksheet_from_query(sheet_name="States", query={"filename": "select_states"}) report.create_worksheet_from_query(sheet_name="Counties / Etc", query={"filename": "select_counties"}) report.create_worksheet_from_query( sheet_name="Doesn't Exist", query={"filename": "this_query_doesnt_exist"}) report.to_recipients = ['*****@*****.**'] report.cc_recipients = [ '*****@*****.**', '*****@*****.**', '*****@*****.**' ] report.subject = "Sample Report 4: This One Doesn't Work" report.message = "Please find the sample report attached." report.execute()
def main(): report = BasicReport(report_title="US Geography - Counties by State") report.build_file() with QueryExecutor(db="DemoDB") as exec: result = exec.execute_query(filename="counties_and_subdivision_counts") report.make_worksheet(sheet_name="All States", query_results=result) by_state = ResultFilter(result_to_filter=result, filter_by="state_name") by_state.filter() for state_name, state_data in by_state: report.make_worksheet(sheet_name=state_name, query_results=state_data) report.to_recipients = ['*****@*****.**'] report.cc_recipients = [ '*****@*****.**', '*****@*****.**', '*****@*****.**' ] report.subject = "Sample Report 2: US Geography - Counties by State" report.message = "Please find the sample report attached." report.execute()
def test_debug_mode_integration(self): config.set('Debug', 'debug_mode', 'False') report = BasicReport(report_title='Basic Report - Test', debug_mode=True) report.send_email = MethodType(mocked_send_email, report) report.build_file() report.create_worksheet_from_query(sheet_name='Sheet1', sql=TEST_QUERY) report.to_recipients.append( config['Default']['notification_recipient']) report.subject = 'Basic Report - Test' report.message = 'Basic Report Test' report.execute() self.assertTrue(report.debug_mode) self.assertTrue(report.email.debug_mode) config.set('Debug', 'debug_mode', 'True')
def test_basic_functionality(self): report = BasicReport(report_title='Basic Report - Test') report.send_email = MethodType(mocked_send_email, report) report.build_file() report.create_worksheet_from_query(sheet_name='Sheet1', sql=TEST_QUERY) report.to_recipients.append( config['Default']['notification_recipient']) report.subject = 'Basic Report - Test' report.message = 'Basic Report Test' report.execute()