Various bug fixes.
This commit is contained in:
@@ -123,6 +123,7 @@ This is meant to import .xslx files created from the Design & Analysis Software
|
||||
6. Install dependencies: ```pip install -r requirements.txt```
|
||||
|
||||
## Database:
|
||||
*If using a pre-existing database, skip this.*
|
||||
|
||||
1. Copy 'alembic_default.ini' to 'alembic.ini' in the same folder.
|
||||
2. Open 'alembic.ini' and edit 'sqlalchemy.url' to the desired path of the database.
|
||||
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@@ -443,19 +443,23 @@ class Settings(BaseSettings, extra="allow"):
|
||||
if 'pytest' in sys.modules:
|
||||
output = dict(power_users=['lwark', 'styson', 'ruwang'])
|
||||
else:
|
||||
print(f"Hello from database settings getter.")
|
||||
|
||||
# session = Session(create_engine(f"sqlite:///{db_path}"))
|
||||
logger.debug(self.__dict__)
|
||||
# print(self.__dict__)
|
||||
session = self.database_session
|
||||
metadata = MetaData()
|
||||
# print(self.database_session.get_bind())
|
||||
try:
|
||||
tables = metadata.reflect(bind=session.get_bind()).tables.keys()
|
||||
except AttributeError:
|
||||
metadata.reflect(bind=session.get_bind())
|
||||
except AttributeError as e:
|
||||
print(f"Error getting tables: {e}")
|
||||
return
|
||||
if "_configitem" not in tables:
|
||||
if "_configitem" not in metadata.tables.keys():
|
||||
print(f"Couldn't find _configitems in {metadata.tables.keys()}.")
|
||||
return
|
||||
config_items = session.execute(text("SELECT * FROM _configitem")).all()
|
||||
session.close()
|
||||
# print(config_items)
|
||||
# print(f"Config: {pprint.pprint(config_items)}")
|
||||
output = {}
|
||||
for item in config_items:
|
||||
try:
|
||||
@@ -467,6 +471,7 @@ class Settings(BaseSettings, extra="allow"):
|
||||
if not hasattr(self, k):
|
||||
self.__setattr__(k, v)
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_alembic_db_path(cls, alembic_path, mode=Literal['path', 'schema', 'user', 'pass']) -> Path | str:
|
||||
c = ConfigParser()
|
||||
|
||||
Reference in New Issue
Block a user