#!/usr/bin/python
# coding=utf-8
import records
from pithy import config_manager

# 获取配置管理器
config = config_manager()

# 生成数据库实例
db = records.Database(config['PITHY_DB'])


# 定义一些数据库查询
def get_user_id(username):
    """
    根据用户名获取用户ID
    """
    rows = db.query('select * from user where username=:username', username=username)
    return rows[0].id

if __name__ == '__main__':
    print(get_user_id('pithy'))