Пример #1
0
 def __init__(self):
     cf = Config()
     self.conn = psycopg2.connect(host=cf.get_db('db_host'),
                                  port=cf.get_db('db_port'),
                                  dbname=cf.get_db('db_name'),
                                  user=cf.get_db('db_user'),
                                  password=cf.get_db('db_passwd'))
     self.cur = self.conn.cursor()
Пример #2
0
 def __init__(self):
     cf = Config()
     self.conn = pymysql.connect(host=cf.get_db('db_host'),
                                 port=int(cf.get_db('db_port')),
                                 db=cf.get_db('db_name'),
                                 user=cf.get_db('db_user'),
                                 passwd=cf.get_db('db_passwd'),
                                 charset='utf8')
     self.cur = self.conn.cursor()