engines.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:pyetje 作者: rorlika 项目源码 文件源码
def utf8_engine(url=None, options=None):
    """Hook for dialects or drivers that don't handle utf8 by default."""

    from sqlalchemy.engine import url as engine_url

    if config.db.dialect.name == 'mysql' and \
        config.db.driver in ['mysqldb', 'pymysql', 'cymysql']:
        # note 1.2.1.gamma.6 or greater of MySQLdb
        # needed here
        url = url or config.db_url
        url = engine_url.make_url(url)
        url.query['charset'] = 'utf8'
        url.query['use_unicode'] = '0'
        url = str(url)

    return testing_engine(url, options)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号