rudemaps/dbmanager.py
2017-02-11 15:33:48 +01:00

17 lines
414 B
Python

import psycopg2
import psycopg2.extras
class DbManager(object):
def __init__(self,db_uri):
self.db_uri=db_uri
self.conn=psycopg2.connect(db_uri,cursor_factory=psycopg2.extras.DictCursor)
def load_user(self,username):
with self.conn.cursor() as c:
c.execute("select * from users where username=%s",(username,))
user=c.fetchOne()
return user