SQLiteConnection.py 文件源码

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

项目:AstroObjectSchema 作者: HackCoolStars 项目源码 文件源码
def _fk_pragma_on_connect(dbapi_con, connection_record):
    ''' Code to execute every time the database connection is opened.

    Ref: http://docs.sqlalchemy.org/en/rel_0_9/core/event.html#sqlalchemy.event.listens_for
    '''
    # Support for foreign keys must be explicitly turned on
    # every time the database is opened.
    dbapi_con.execute('PRAGMA foreign_keys=ON')

    # Only uncomment these if you know what you are doing.
    # See the SQLite documentation for details.
    #dbapi_con.execute("PRAGMA journal_mode = MEMORY")
    #dbapi_con.execute("PRAGMA synchronous = OFF")
    #dbapi_con.execute("PRAGMA temp_store = MEMORY")
    #dbapi_con.execute("PRAGMA cache_size = 500000")

# This allows the file to be 'import'ed any number of times, but attempts to
# connect to the database only once.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号