add example import script
This commit is contained in:
parent
42e4b43f0c
commit
38f682a2d6
16
import.py
Normal file
16
import.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Load .env file
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
import argparse
|
||||
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from truthinquiry.ext.database.sa import engine
|
||||
from truthinquiry.ext.database.models import *
|
||||
|
||||
Session = sessionmaker(bind=engine)
|
||||
session = Session()
|
||||
|
||||
results = session.query(Npc).all()
|
||||
print(results)
|
6
truthinquiry/ext/database/sa.py
Normal file
6
truthinquiry/ext/database/sa.py
Normal file
@ -0,0 +1,6 @@
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
from truthinquiry.ext.database.models import Base
|
||||
from truthinquiry.ext.database.db_url import get_db_url
|
||||
|
||||
engine = create_engine(get_db_url())
|
Loading…
Reference in New Issue
Block a user