ha22109
ha22109

Reputation: 8316

python db connection

I am having a script which makes a db connection and pereform some select operation.accroding to the fetch data i am calling different functions which also perform db operations.How can i pass db connection to the functions which are being called as i donot want to make new connection

Upvotes: 0

Views: 544

Answers (1)

kender
kender

Reputation: 87131

Why to pass connection itself? Maybe build a class that handles all the DB-operation and just pass this class' instance around, calling it's methods to perform selects, inserts and all that DB-specific code?

Upvotes: 2

Related Questions