15 lines
351 B
Python
15 lines
351 B
Python
|
|
# -*- coding: utf-8 -*-
|
||
|
|
# @Time : 2024/11/19 下午6:07
|
||
|
|
# @Author : 河瞬
|
||
|
|
# @FileName: database.py
|
||
|
|
# @Software: PyCharm
|
||
|
|
from sqlmodel import SQLModel, create_engine
|
||
|
|
|
||
|
|
sqlite_file_name = "test.db"
|
||
|
|
sqlite_url = f"sqlite:///{sqlite_file_name}"
|
||
|
|
|
||
|
|
engine = create_engine(sqlite_url)
|
||
|
|
|
||
|
|
|
||
|
|
def create_db_and_tables():
|
||
|
|
SQLModel.metadata.create_all(engine)
|