📜  python 在内存中创建 sqlite db - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:46.036000             🧑  作者: Mango

代码示例1
import sqlite3
from sqlite3 import Error


def create_connection():
    """ create a database connection to a database that resides
        in the memory
    """
    conn = None;
    try:
        conn = sqlite3.connect(':memory:')
        print(sqlite3.version)
    except Error as e:
        print(e)
    finally:
        if conn:
            conn.close()


if __name__ == '__main__':
    create_connection()
Code language: Python (python)