added working sqlquery test in table_contents
This commit is contained in:
parent
78e313ad29
commit
bda8907a97
@ -9,7 +9,7 @@ from sqlalchemy import Integer, String, Column, Float
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import uuid
|
import uuid
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
from sqlalchemy import inspect
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import DeclarativeBase
|
from sqlalchemy.orm import DeclarativeBase
|
||||||
from flask_wtf.csrf import CSRFProtect
|
from flask_wtf.csrf import CSRFProtect
|
||||||
import os
|
import os
|
||||||
@ -529,7 +529,18 @@ def table_contents():
|
|||||||
#meta.reflect(db.engine) # Uncomment this to also get the hidden tables, but this crashes rn
|
#meta.reflect(db.engine) # Uncomment this to also get the hidden tables, but this crashes rn
|
||||||
tables = meta.tables.keys()
|
tables = meta.tables.keys()
|
||||||
table_contents = {}
|
table_contents = {}
|
||||||
#print(tables)
|
|
||||||
|
#Testing querys for exporting etc
|
||||||
|
print("tables: ",tables)
|
||||||
|
print("testquerys:")
|
||||||
|
qtable = meta.tables["default_demographic_test"]
|
||||||
|
query1 = select(qtable).where(qtable.c.alter == 78)
|
||||||
|
print("Query 1: ", query1)
|
||||||
|
print("Query 1 result: ")
|
||||||
|
|
||||||
|
for row in db.session.execute(query1):
|
||||||
|
print(row)
|
||||||
|
#Test End
|
||||||
|
|
||||||
for table_name in tables:
|
for table_name in tables:
|
||||||
table = meta.tables[table_name]
|
table = meta.tables[table_name]
|
||||||
|
Loading…
Reference in New Issue
Block a user