From 37d53cf6e01bdc621c69cc7b57e8c9c51f8d6ad0 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Sun, 26 Feb 2017 16:13:23 -0800 Subject: [PATCH 01/12] Work on donordb_select.py update donor.db --- mmf69/session07/donor.db | Bin 3072 -> 3072 bytes mmf69/session07/donordb_select.py | 20 +++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mmf69/session07/donor.db b/mmf69/session07/donor.db index ba4a7bd4e99d33d3668c0f358e7d1a1adb7ea2b3..bee874bc23c61de5fefb7c14849fc0723acc5730 100644 GIT binary patch delta 177 zcmZpWXpop7Ehxyqz`zW|Fu*@i#~3K6`;42HS&xB<={6(NZRY5Wh1pE80ZeS-+S-hf zC5cHnsl|mknI)<5#i@m*sd>rhTxRDWSH}=ng%C$4A6Er5wHkSexv4rpothv^b;Ttm m8Jj96r!p%uH!3l2j$>ZL!ov%aVF3{gOq&Hc-ZM`OUNS&3t~dB1Rse&y7nJ}2 diff --git a/mmf69/session07/donordb_select.py b/mmf69/session07/donordb_select.py index ac8de67..2b43721 100644 --- a/mmf69/session07/donordb_select.py +++ b/mmf69/session07/donordb_select.py @@ -5,11 +5,21 @@ conn = sqlite3.connect('donor.db') print("Opened database successfully") -cursor = conn.execute("SELECT DONOR_ID,DONOR_NAME,DONATION_AMOUNT from DONORS") +cursor = conn.execute("SELECT DONOR_ID,DONOR_NAME,DONATION_AMOUNT from DONORS") for row in cursor: - print("DONOR_ID = ", row[0]) - print("DONOR_NAME = ", row[1]) - print("DONATION_AMOUNT = ", row[2], "\n") + print(row) + + +cursor = conn.execute("SELECT DONOR_ID,DONOR_NAME,total(DONATION_AMOUNT)," + "count(distinct DONATION_AMOUNT),total(DONATION_AMOUNT)/count(distinct DONATION_AMOUNT)" + " from donors group by DONOR_ID,DONOR_NAME") +for row in cursor: + print("DONOR_ID = ", row[0]) + print("DONOR_NAME = ", row[1]) + print("TOTAL_DONATIONS = ", row[3]) + print("DONATION_AMOUNT = ", row[2]) + print("AVERAGE_DONATION = ", row[4], "\n") print("Operation done successfully") -conn.close() \ No newline at end of file + +conn.close() From b8534b1061cb7d16ed59c50ee41ce52ccf0ec1f8 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Sun, 26 Feb 2017 19:05:49 -0800 Subject: [PATCH 02/12] Use prettytable to create Donor Report. Need to figure out how to add a title row without having to use a print() --- mmf69/session07/donordb_select.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mmf69/session07/donordb_select.py b/mmf69/session07/donordb_select.py index 2b43721..15e3d0b 100644 --- a/mmf69/session07/donordb_select.py +++ b/mmf69/session07/donordb_select.py @@ -1,7 +1,9 @@ #!/usr/bin/python +from prettytable import PrettyTable import sqlite3 + conn = sqlite3.connect('donor.db') print("Opened database successfully") @@ -20,6 +22,28 @@ print("DONATION_AMOUNT = ", row[2]) print("AVERAGE_DONATION = ", row[4], "\n") + +print("**********************DONOR REPORT*******************") + +cursor = conn.execute("SELECT DONOR_ID as 'Donor ID',DONOR_NAME as 'Donor Name'," + "total(DONATION_AMOUNT) AS 'Total Donations'," + "count(distinct DONATION_AMOUNT) AS 'Number of Donations'," + "total(DONATION_AMOUNT)/count(distinct DONATION_AMOUNT) AS AVERAGE_DONATION" + " from donors group by DONOR_ID,DONOR_NAME") + +col_names = [cn[0] for cn in cursor.description] +rows = cursor.fetchall() + +x = PrettyTable(col_names) +x.align[col_names[1]] = "l" +x.align[col_names[2]] = "r" +x.padding_width = 1 +for row in rows: + x.add_row(row) + +print(x) + + print("Operation done successfully") conn.close() From 0a68694f29acdee0ec1fa94ff77b999806189107 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Mon, 27 Feb 2017 09:44:18 -0800 Subject: [PATCH 03/12] Adding donor_report.py minor changes to donordb_select and donor.db --- mmf69/session07/donor.db | Bin 3072 -> 3072 bytes mmf69/session07/donor_report.py | 31 ++++++++++++++++++++++++++++++ mmf69/session07/donordb_select.py | 24 +++-------------------- 3 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 mmf69/session07/donor_report.py diff --git a/mmf69/session07/donor.db b/mmf69/session07/donor.db index bee874bc23c61de5fefb7c14849fc0723acc5730..752eff08a63a41af1e30f9920eac7e6aacb11c94 100644 GIT binary patch delta 113 zcmZpWXpop7%_uZc#+gxQW5N<<2`=Ui2IjBK&zbKqUtm7Mypwq~^8)56%pIE*S#p?d zxVTstMHyLwN|P!jxj5l$BTfz$Mqx(gkj&f^9(EQ+Nk*pNlEk8%L?cc%7EV#d;KZWD Kl+8!jZCC(Mf*QL3 delta 42 ycmZpWXpop7%_ulg#+gxYW5N< Date: Mon, 27 Feb 2017 12:50:44 -0800 Subject: [PATCH 04/12] Update donor_report.py and donor_list.py --- mmf69/session07/donor_list.py | 28 +++++++++++++++++++++ mmf69/session07/donor_report.py | 43 ++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 mmf69/session07/donor_list.py diff --git a/mmf69/session07/donor_list.py b/mmf69/session07/donor_list.py new file mode 100644 index 0000000..2e9e9ac --- /dev/null +++ b/mmf69/session07/donor_list.py @@ -0,0 +1,28 @@ +#!/usr/bin/python + +from prettytable import PrettyTable +import sqlite3 + +conn = sqlite3.connect('donor.db') +print("Opened database successfully") + + +def donor_list(): + print("********DONORS***********") + cursor = conn.execute("SELECT DISTINCT DONOR_ID as 'Donor ID'," + "DONOR_NAME as 'Donor Name' from donors order by DONOR_ID") + col_names = [cn[0] for cn in cursor.description] + rows = cursor.fetchall() + x = PrettyTable(col_names) + x.align[col_names[0]] = "c" + x.align[col_names[1]] = "l" + x.padding_width = 1 + for row in rows: + x.add_row(row) + print(x) + +donor_list() + +print("Operation done successfully") + +conn.close() diff --git a/mmf69/session07/donor_report.py b/mmf69/session07/donor_report.py index f6de1ac..347be6d 100644 --- a/mmf69/session07/donor_report.py +++ b/mmf69/session07/donor_report.py @@ -6,26 +6,29 @@ conn = sqlite3.connect('donor.db') print("Opened database successfully") -print("*********************************DONOR REPORT***************************************") -cursor = conn.execute("SELECT DONOR_ID as 'Donor ID',DONOR_NAME as 'Donor Name'," - "total(DONATION_AMOUNT) AS 'Total Donations'," - "count(DONOR_ID) AS 'Number of Donations'," - "total(DONATION_AMOUNT)/count(DONOR_ID) AS AVERAGE_DONATION" - " from donors group by DONOR_ID,DONOR_NAME") - -col_names = [cn[0] for cn in cursor.description] -rows = cursor.fetchall() - -x = PrettyTable(col_names) -x.align[col_names[1]] = "l" -x.align[col_names[2]] = "r" -x.padding_width = 1 -for row in rows: - x.add_row(row) - -print(x) - -print("Operation done successfully") +def donor_report(): + print("*********************************DONOR REPORT***************************************") + cursor = conn.execute("SELECT DONOR_ID as 'Donor ID',DONOR_NAME as 'Donor Name'," + "total(DONATION_AMOUNT) AS 'Total Donations'," + "count(DONOR_ID) AS 'Number of Donations'," + "total(DONATION_AMOUNT)/count(DONOR_ID) AS 'Average Donation'" + " from donors group by DONOR_ID,DONOR_NAME") + col_names = [cn[0] for cn in cursor.description] + rows = cursor.fetchall() + x = PrettyTable(col_names) + x.align[col_names[1]] = "l" + x.align[col_names[2]] = "r" + x.align[col_names[3]] = "c" + x.align[col_names[4]] = "r" + x.padding_width = 1 + for row in rows: + x.add_row(row) + print(x) + + +print(donor_report()) + +# print("Operation done successfully") conn.close() From b94d54abdd3bf481218b90b5eaae37198a807e41 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Mon, 27 Feb 2017 12:51:16 -0800 Subject: [PATCH 05/12] Revert donordb_select.py --- mmf69/session07/donordb_select.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mmf69/session07/donordb_select.py b/mmf69/session07/donordb_select.py index f6de1ac..2faf403 100644 --- a/mmf69/session07/donordb_select.py +++ b/mmf69/session07/donordb_select.py @@ -3,9 +3,26 @@ from prettytable import PrettyTable import sqlite3 + conn = sqlite3.connect('donor.db') print("Opened database successfully") +cursor = conn.execute("SELECT DONOR_ID,DONOR_NAME,DONATION_AMOUNT from DONORS") +for row in cursor: + print(row) + + +cursor = conn.execute("SELECT DONOR_ID,DONOR_NAME,total(DONATION_AMOUNT)," + "count(distinct DONATION_AMOUNT),total(DONATION_AMOUNT)/count(distinct DONATION_AMOUNT)" + " from donors group by DONOR_ID,DONOR_NAME") +for row in cursor: + print("DONOR_ID = ", row[0]) + print("DONOR_NAME = ", row[1]) + print("TOTAL_DONATIONS = ", row[3]) + print("DONATION_AMOUNT = ", row[2]) + print("AVERAGE_DONATION = ", row[4], "\n") + + print("*********************************DONOR REPORT***************************************") cursor = conn.execute("SELECT DONOR_ID as 'Donor ID',DONOR_NAME as 'Donor Name'," @@ -26,6 +43,7 @@ print(x) + print("Operation done successfully") conn.close() From e89a4913767c912a8a00fa11269de4aec6af8940 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Mon, 27 Feb 2017 15:01:23 -0800 Subject: [PATCH 06/12] Add database_tools.py --- mmf69/session07/database_tools.py | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 mmf69/session07/database_tools.py diff --git a/mmf69/session07/database_tools.py b/mmf69/session07/database_tools.py new file mode 100644 index 0000000..dddd07d --- /dev/null +++ b/mmf69/session07/database_tools.py @@ -0,0 +1,61 @@ +#!/usr/bin/python + +import sqlite3 + +conn = sqlite3.connect('donor.db') + +print("Opened database successfully") + + +def drop_table(): + try: + conn.execute("drop table if exists donors") + except IOError as error: + print(error) + + +def create_table(): + try: + conn.execute('''CREATE TABLE DONORS + (DONOR_ID INT NOT NULL, + DONOR_NAME TEXT NOT NULL, + DONATION_AMOUNT REAL);''') + print("Table created successfully") + except IOError as error: + print(error) + + +def insert_data(): + try: + conn.execute("INSERT INTO DONORS (DONOR_ID,DONOR_NAME,DONATION_AMOUNT) \ + VALUES (1, 'Sara', 100.00)") + + conn.execute("INSERT INTO DONORS (DONOR_ID,DONOR_NAME,DONATION_AMOUNT) \ + VALUES (2, 'Starla', 50.00)") + + conn.execute("INSERT INTO DONORS (DONOR_ID,DONOR_NAME,DONATION_AMOUNT) \ + VALUES (3, 'Tim', 100.00)") + + conn.execute("INSERT INTO DONORS (DONOR_ID,DONOR_NAME,DONATION_AMOUNT) \ + VALUES (4, 'Ruby', 50.00)") + + conn.execute("INSERT INTO DONORS (DONOR_ID,DONOR_NAME,DONATION_AMOUNT) \ + VALUES (4, 'Ruby', 25.00)") + + conn.commit() + print("Records created successfully") + except IOError as error: + print(error) + + +def menu_options(): + """Make a function for the code that allows the user to Add or Remove tasks from the list, + plus save the tasks in the List tasks-priorities using numbered choices.""" + print(""" + Please Select an option: + 1) Drop Table + 2) Create Table + 3) Insert Initial Data + 4) Exit Tool + """) + From 3365cbad62245b3c29b049abd300e31d3ce221d1 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Wed, 1 Mar 2017 18:43:23 -0800 Subject: [PATCH 07/12] Remove print(donor_report()) cause that was just wrong. --- mmf69/session07/donor_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmf69/session07/donor_report.py b/mmf69/session07/donor_report.py index 347be6d..38e2921 100644 --- a/mmf69/session07/donor_report.py +++ b/mmf69/session07/donor_report.py @@ -27,8 +27,8 @@ def donor_report(): print(x) -print(donor_report()) +donor_report() -# print("Operation done successfully") +print("Operation done successfully") conn.close() From 9354744853a3a316c2b9447e1a90557f133aeb8c Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Wed, 8 Mar 2017 20:59:59 -0800 Subject: [PATCH 08/12] Adding Circle_class.py - started in class. --- mmf69/session09/Circle_Class.py | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 mmf69/session09/Circle_Class.py diff --git a/mmf69/session09/Circle_Class.py b/mmf69/session09/Circle_Class.py new file mode 100644 index 0000000..4957623 --- /dev/null +++ b/mmf69/session09/Circle_Class.py @@ -0,0 +1,43 @@ +from math import pi, sqrt + + +class Circle(object): + + def __init__(self, radius): + self._radius = radius + + @staticmethod + def radius_to_area(radius): + return pi * radius ** 2 + + @classmethod + def from_diameter(cls, diameter): + return cls(diameter/2) + + @classmethod + def from_area(cls, area): + return cls(sqrt(area/pi)) + + @property + def radius(self): + return self._radius + + @radius.setter + def radius(self, radius): + self._radius = radius + + @property + def diameter(self): + return self._radius * 2 + + @diameter.setter + def diameter(self, diameter): + self._radius = diameter / 2 + +# print(Circle.radius_to_area(1)) +c = Circle.from_diameter(8) +print(c.diameter) +print(c.radius) + + + From 3b0aefb1d76bffe8370e51b34d45491556f5f50e Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Wed, 15 Mar 2017 15:35:39 -0700 Subject: [PATCH 09/12] Refactor with sqlite db --- mmf69/session07/Mailroom.py | 128 ++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 mmf69/session07/Mailroom.py diff --git a/mmf69/session07/Mailroom.py b/mmf69/session07/Mailroom.py new file mode 100644 index 0000000..cbe57d0 --- /dev/null +++ b/mmf69/session07/Mailroom.py @@ -0,0 +1,128 @@ +#!/usr/bin/python + +from prettytable import PrettyTable +import sqlite3 +import locale + +locale.setlocale(locale.LC_ALL, '') +'English_United States.1252' +locale.currency(188518982.18) +'$188518982.18' + +conn = sqlite3.connect('donor.db') + + +# print("Opened database successfully") + + +def donor_list(): + print("********DONORS***********") + cursor = conn.execute("SELECT DISTINCT DONOR_ID as 'Donor ID'," + "DONOR_NAME as 'Donor Name' from donors order by DONOR_ID") + col_names = [cn[0] for cn in cursor.description] + rows = cursor.fetchall() + x = PrettyTable(col_names) + x.align[col_names[0]] = "c" + x.align[col_names[1]] = "l" + x.padding_width = 1 + for row in rows: + x.add_row(row) + print(x) + + +def donor_report(): + print("*********************************DONOR REPORT***************************************") + cursor = conn.execute("SELECT DONOR_ID as 'Donor ID',DONOR_NAME as 'Donor Name'," + "total(DONATION_AMOUNT) AS 'Total Donations'," + "count(DONOR_ID) AS 'Number of Donations'," + "total(DONATION_AMOUNT)/count(DONOR_ID) AS 'Average Donation'" + " from donors group by DONOR_ID,DONOR_NAME") + col_names = [cn[0] for cn in cursor.description] + rows = cursor.fetchall() + x = PrettyTable(col_names) + x.align[col_names[1]] = "l" + x.align[col_names[2]] = "r" + x.align[col_names[3]] = "c" + x.align[col_names[4]] = "r" + x.padding_width = 1 + for row in rows: + x.add_row(row) + print(x) + + +def thank_you(): + cursor = conn.execute("SELECT DONOR_NAME as 'Donor Name'," + "total(DONATION_AMOUNT) AS 'Total Donations'" + " from donors group by DONOR_ID,DONOR_NAME") + rows = cursor.fetchall() + for row in rows: + with open('mailroom-thankyou-{}.txt'.format(row[0]), 'w') as f: + f.write('Dear ' + str(row[0]) + ', \n' + 'Thank you for you generous donation of ' + + locale.currency(row[1], 'True') + '.\n' + 'Your continued support of my fundraising efforts for the Big Climb keeps me motivated. \n' + 'Together we WILL find a cure for Blood Related Cancers! \n' + 'Thank you, \n' + 'Matt') + + +def list_donor_files(): + import glob + print(glob.glob("mailroom-thankyou-*.txt")) + + +def menu_options(): + print(""" + Please Select an option: + 1) Add a Donor/Donation + 2) View Donor List + 3) Print Report + 4) Send "Thank You" + 5) Save all tasks to the Donor file and exit! + """) + + +def main(): + """Coordinates I/O and actions""" + try: + # Display a menu of choices to the user + # and Process user I/0 + while True: + menu_options() + str_choice = str(input("Which option would you like to perform? [1 to 5]")) + # Need to add if/elif for adding donor/donation + if str_choice == '1': # 1) Add a new item. + new_donor = str(input("What is the donor's name?")) + contribution = int(input("What is the amount?")) + add_donation(donor_db, new_donor, contribution) + # donor_report(gTodoTasks) + continue + + elif str_choice == '2': # Print List + donor_list() + + elif str_choice == '3': # Print Report + donor_report() + continue + elif str_choice == '4': + list_donor_files() + continue + elif str_choice == '5': + # Save (commit) the changes + conn.commit() + conn.close() + print("Operation done successfully") + exit() + else: + print(Exception( + "\nThat isn't a valid input. Please select a number from [1 to 5]")) # Message in case user enters the incorrect number + # donor_report(gTodoTasks) + continue + except IOError as error: # Handles any Python errors + print("Hmmm something isn't right...") + print("pythons error info: ") + print(error) + + +# start the program +main() # Call the Main function at the start of the script From 8f5baa62d0b3655c577bd8ecdc23b63971ae3ee9 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Wed, 15 Mar 2017 16:14:58 -0700 Subject: [PATCH 10/12] Every thing in Mailroom with sqlite is working except for adding new donors. --- mmf69/session07/Mailroom.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mmf69/session07/Mailroom.py b/mmf69/session07/Mailroom.py index cbe57d0..d13a78f 100644 --- a/mmf69/session07/Mailroom.py +++ b/mmf69/session07/Mailroom.py @@ -15,6 +15,11 @@ # print("Opened database successfully") +def add_donation(): + conn.execute("INSERT INTO DONORS (DONOR_ID,DONOR_NAME,DONATION_AMOUNT) \ + VALUES (3, 'Tim', 100.00)") + + def donor_list(): print("********DONORS***********") cursor = conn.execute("SELECT DISTINCT DONOR_ID as 'Donor ID'," @@ -61,7 +66,7 @@ def thank_you(): 'Thank you for you generous donation of ' + locale.currency(row[1], 'True') + '.\n' 'Your continued support of my fundraising efforts for the Big Climb keeps me motivated. \n' - 'Together we WILL find a cure for Blood Related Cancers! \n' + 'Together we WILL find a cure for Blood related cancers! \n' 'Thank you, \n' 'Matt') @@ -94,7 +99,7 @@ def main(): if str_choice == '1': # 1) Add a new item. new_donor = str(input("What is the donor's name?")) contribution = int(input("What is the amount?")) - add_donation(donor_db, new_donor, contribution) + add_donation() # donor_report(gTodoTasks) continue From 2aca7392668d56811d0b8e4d8d2b209af18a4aed Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Wed, 15 Mar 2017 16:16:18 -0700 Subject: [PATCH 11/12] Adding Mailroom.py generated Thank You .txt files. --- mmf69/session07/mailroom-thankyou-Ruby.txt | 6 ++++++ mmf69/session07/mailroom-thankyou-Sara.txt | 6 ++++++ mmf69/session07/mailroom-thankyou-Starla.txt | 6 ++++++ mmf69/session07/mailroom-thankyou-Tim.txt | 6 ++++++ 4 files changed, 24 insertions(+) create mode 100644 mmf69/session07/mailroom-thankyou-Ruby.txt create mode 100644 mmf69/session07/mailroom-thankyou-Sara.txt create mode 100644 mmf69/session07/mailroom-thankyou-Starla.txt create mode 100644 mmf69/session07/mailroom-thankyou-Tim.txt diff --git a/mmf69/session07/mailroom-thankyou-Ruby.txt b/mmf69/session07/mailroom-thankyou-Ruby.txt new file mode 100644 index 0000000..683d7e4 --- /dev/null +++ b/mmf69/session07/mailroom-thankyou-Ruby.txt @@ -0,0 +1,6 @@ +Dear Ruby, +Thank you for you generous donation of $150.00. +Your continued support of my fundraising efforts for the Big Climb keeps me motivated. +Together we WILL find a cure for Blood related cancers! +Thank you, +Matt \ No newline at end of file diff --git a/mmf69/session07/mailroom-thankyou-Sara.txt b/mmf69/session07/mailroom-thankyou-Sara.txt new file mode 100644 index 0000000..602bd12 --- /dev/null +++ b/mmf69/session07/mailroom-thankyou-Sara.txt @@ -0,0 +1,6 @@ +Dear Sara, +Thank you for you generous donation of $200.00. +Your continued support of my fundraising efforts for the Big Climb keeps me motivated. +Together we WILL find a cure for Blood related cancers! +Thank you, +Matt \ No newline at end of file diff --git a/mmf69/session07/mailroom-thankyou-Starla.txt b/mmf69/session07/mailroom-thankyou-Starla.txt new file mode 100644 index 0000000..d419cc5 --- /dev/null +++ b/mmf69/session07/mailroom-thankyou-Starla.txt @@ -0,0 +1,6 @@ +Dear Starla, +Thank you for you generous donation of $100.00. +Your continued support of my fundraising efforts for the Big Climb keeps me motivated. +Together we WILL find a cure for Blood related cancers! +Thank you, +Matt \ No newline at end of file diff --git a/mmf69/session07/mailroom-thankyou-Tim.txt b/mmf69/session07/mailroom-thankyou-Tim.txt new file mode 100644 index 0000000..b6baacd --- /dev/null +++ b/mmf69/session07/mailroom-thankyou-Tim.txt @@ -0,0 +1,6 @@ +Dear Tim, +Thank you for you generous donation of $200.00. +Your continued support of my fundraising efforts for the Big Climb keeps me motivated. +Together we WILL find a cure for Blood related cancers! +Thank you, +Matt \ No newline at end of file From c3a01209bbe6f03c7b7afc0e77e346941781b081 Mon Sep 17 00:00:00 2001 From: "Feliciano, Matthew" Date: Wed, 15 Mar 2017 16:20:20 -0700 Subject: [PATCH 12/12] Adding my db tools --- mmf69/session07/donordb_select.py | 3 ++- mmf69/session07/{Drop_donordb.py => drop_donordb.py} | 0 .../{Insert_Initial_Donors.py => insert_initial_donors.py} | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename mmf69/session07/{Drop_donordb.py => drop_donordb.py} (100%) rename mmf69/session07/{Insert_Initial_Donors.py => insert_initial_donors.py} (100%) diff --git a/mmf69/session07/donordb_select.py b/mmf69/session07/donordb_select.py index 2faf403..6cac041 100644 --- a/mmf69/session07/donordb_select.py +++ b/mmf69/session07/donordb_select.py @@ -15,12 +15,13 @@ cursor = conn.execute("SELECT DONOR_ID,DONOR_NAME,total(DONATION_AMOUNT)," "count(distinct DONATION_AMOUNT),total(DONATION_AMOUNT)/count(distinct DONATION_AMOUNT)" " from donors group by DONOR_ID,DONOR_NAME") -for row in cursor: +'''for row in cursor: print("DONOR_ID = ", row[0]) print("DONOR_NAME = ", row[1]) print("TOTAL_DONATIONS = ", row[3]) print("DONATION_AMOUNT = ", row[2]) print("AVERAGE_DONATION = ", row[4], "\n") + ''' print("*********************************DONOR REPORT***************************************") diff --git a/mmf69/session07/Drop_donordb.py b/mmf69/session07/drop_donordb.py similarity index 100% rename from mmf69/session07/Drop_donordb.py rename to mmf69/session07/drop_donordb.py diff --git a/mmf69/session07/Insert_Initial_Donors.py b/mmf69/session07/insert_initial_donors.py similarity index 100% rename from mmf69/session07/Insert_Initial_Donors.py rename to mmf69/session07/insert_initial_donors.py