Python Forum
Object Oriented DB Interactions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object Oriented DB Interactions
#3
Currently I use xlrd xlwr with psycopg2 to move transaction records in and out of spreadsheets and postgres. That works but I am interested in learning OOP and it seemed like I could incorporate OOP in my current efforts My first question to the forum is whether or not that really makes sense practically?

My idea is to create a transaction class:

class transaction:
     def__init__(self,date,account,amount,theater,sales_num):
           self.date = date
           self.account = account
           self.amount = amount
           self.theater = theater
           self.sales_num = sales_num

with attributes that map to the column headings for each spreadsheet / DB table. Further, I could create methods such as selects, inserts and updates which would retrieve, create and modify those transaction records.

I can't imagine this hasn't been done with more knowledge and skill than I have so, assuming this approach makes sense, I was hoping the forum could provide some coaching on the pros and cons and possibly best strategy of this approach.

Best,

Hagen
Reply


Messages In This Thread
Object Oriented DB Interactions - by datasundae - May-25-2018, 09:28 PM
RE: Object Oriented DB Interactions - by datasundae - May-25-2018, 09:44 PM
Object Oriented Spreadsheet & DB Interactions - by datasundae - May-25-2018, 09:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb Object Oriented programming (OOP) problem OmegaRed94 6 2,953 May-31-2021, 07:19 PM
Last Post: OmegaRed94
  proteins interactions Amniote 2 2,079 May-23-2019, 07:07 AM
Last Post: Amniote
  Object Oriented Programming jackbk 8 4,500 Aug-24-2018, 01:13 PM
Last Post: Windspar
  Oriented Object ldthan 1 2,418 Mar-27-2018, 11:26 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020