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```
|
6. Install dependencies: ```pip install -r requirements.txt```
|
||||||
|
|
||||||
## Database:
|
## Database:
|
||||||
|
*If using a pre-existing database, skip this.*
|
||||||
|
|
||||||
1. Copy 'alembic_default.ini' to 'alembic.ini' in the same folder.
|
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.
|
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:
|
if 'pytest' in sys.modules:
|
||||||
output = dict(power_users=['lwark', 'styson', 'ruwang'])
|
output = dict(power_users=['lwark', 'styson', 'ruwang'])
|
||||||
else:
|
else:
|
||||||
|
print(f"Hello from database settings getter.")
|
||||||
|
|
||||||
# session = Session(create_engine(f"sqlite:///{db_path}"))
|
# session = Session(create_engine(f"sqlite:///{db_path}"))
|
||||||
logger.debug(self.__dict__)
|
# print(self.__dict__)
|
||||||
session = self.database_session
|
session = self.database_session
|
||||||
metadata = MetaData()
|
metadata = MetaData()
|
||||||
|
# print(self.database_session.get_bind())
|
||||||
try:
|
try:
|
||||||
tables = metadata.reflect(bind=session.get_bind()).tables.keys()
|
metadata.reflect(bind=session.get_bind())
|
||||||
except AttributeError:
|
except AttributeError as e:
|
||||||
|
print(f"Error getting tables: {e}")
|
||||||
return
|
return
|
||||||
if "_configitem" not in tables:
|
if "_configitem" not in metadata.tables.keys():
|
||||||
|
print(f"Couldn't find _configitems in {metadata.tables.keys()}.")
|
||||||
return
|
return
|
||||||
config_items = session.execute(text("SELECT * FROM _configitem")).all()
|
config_items = session.execute(text("SELECT * FROM _configitem")).all()
|
||||||
session.close()
|
# print(f"Config: {pprint.pprint(config_items)}")
|
||||||
# print(config_items)
|
|
||||||
output = {}
|
output = {}
|
||||||
for item in config_items:
|
for item in config_items:
|
||||||
try:
|
try:
|
||||||
@@ -467,6 +471,7 @@ class Settings(BaseSettings, extra="allow"):
|
|||||||
if not hasattr(self, k):
|
if not hasattr(self, k):
|
||||||
self.__setattr__(k, v)
|
self.__setattr__(k, v)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_alembic_db_path(cls, alembic_path, mode=Literal['path', 'schema', 'user', 'pass']) -> Path | str:
|
def get_alembic_db_path(cls, alembic_path, mode=Literal['path', 'schema', 'user', 'pass']) -> Path | str:
|
||||||
c = ConfigParser()
|
c = ConfigParser()
|
||||||
|
|||||||
Reference in New Issue
Block a user