Work on SQLAlchemy settings
This commit is contained in:
70
admin/requirements_current.txt
Normal file
70
admin/requirements_current.txt
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# Updated manually 2023-09-12 with a lot of trial and error.
|
||||||
|
# A few are commented out even though they are actually used and required. Other packages already pull them in.
|
||||||
|
# SQLAlchemy needs to be upgraded to 2.x. There are issues with async IO or something related to that.
|
||||||
|
# https://docs.sqlalchemy.org/en/14/changelog/migration_20.html
|
||||||
|
|
||||||
|
# aioredis # BAD! Not maintained!
|
||||||
|
aiofiles
|
||||||
|
anyio
|
||||||
|
argon2-cffi
|
||||||
|
argon2-cffi-bindings
|
||||||
|
# asgiref
|
||||||
|
async-timeout
|
||||||
|
baize # added 2023-08-17
|
||||||
|
# certifi
|
||||||
|
# cffi
|
||||||
|
charset-normalizer
|
||||||
|
click
|
||||||
|
Deprecated
|
||||||
|
dnspython
|
||||||
|
email-validator
|
||||||
|
et-xmlfile
|
||||||
|
fastapi>=0.88.0
|
||||||
|
greenlet>=2.0.2
|
||||||
|
gunicorn>=20.1.0
|
||||||
|
h11
|
||||||
|
html2text>=2020.1.16
|
||||||
|
httpcore
|
||||||
|
httptools
|
||||||
|
httpx
|
||||||
|
idna
|
||||||
|
itsdangerous
|
||||||
|
# Jinja2>=3.1.2
|
||||||
|
MarkupSafe
|
||||||
|
mysqlclient
|
||||||
|
numpy>=1.25.2
|
||||||
|
openpyxl
|
||||||
|
orjson
|
||||||
|
# packaging
|
||||||
|
pandas>=2.1.0
|
||||||
|
passlib
|
||||||
|
pdf2image>=1.16.3
|
||||||
|
Pillow>=10.0.0
|
||||||
|
pycparser
|
||||||
|
pydantic>=1.10.12
|
||||||
|
PyJWT>=2.8.0
|
||||||
|
pyparsing
|
||||||
|
python-dateutil
|
||||||
|
python-dotenv
|
||||||
|
python-multipart
|
||||||
|
pytz
|
||||||
|
PyYAML>=6.0.1
|
||||||
|
qrcode>=7.4.2
|
||||||
|
redis[hiredis] # redis==5.0.0 hiredis==2.2.3
|
||||||
|
requests
|
||||||
|
rfc3986
|
||||||
|
six
|
||||||
|
sniffio
|
||||||
|
SQLAlchemy==1.4.49 # 1.4.47 is the newest (2.0.20) I am working with
|
||||||
|
starlette>=0.22.0
|
||||||
|
stripe>=6.4.0
|
||||||
|
typing_extensions
|
||||||
|
ujson
|
||||||
|
urllib3
|
||||||
|
uvicorn
|
||||||
|
uvloop
|
||||||
|
watchfiles
|
||||||
|
watchgod
|
||||||
|
websockets>=11.0.3
|
||||||
|
wrapt
|
||||||
|
xlrd
|
||||||
@@ -15,7 +15,7 @@ db_uri = settings.SQLALCHEMY_DB_URI
|
|||||||
# log.setLevel(logging.INFO)
|
# log.setLevel(logging.INFO)
|
||||||
|
|
||||||
connection_string = db_uri
|
connection_string = db_uri
|
||||||
engine = create_engine(url=connection_string, pool_size=3, max_overflow=15, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='READ COMMITTED', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
engine = create_engine(url=connection_string, pool_size=10, max_overflow=20, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='READ COMMITTED', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
||||||
# NOTE: The default isolation_level is 'REPEATABLE READ'. This can sometimes not show updated data.
|
# NOTE: The default isolation_level is 'REPEATABLE READ'. This can sometimes not show updated data.
|
||||||
# NOTE: The "echo" set to True option shows the SQL queries.
|
# NOTE: The "echo" set to True option shows the SQL queries.
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ def sql_connect(
|
|||||||
settings.SQLALCHEMY_DB_URI = 'mysql://'+DB['username']+':'+DB['password']+'@'+DB['server']+'/'+DB['name']
|
settings.SQLALCHEMY_DB_URI = 'mysql://'+DB['username']+':'+DB['password']+'@'+DB['server']+'/'+DB['name']
|
||||||
log.debug(settings.DB)
|
log.debug(settings.DB)
|
||||||
|
|
||||||
new_engine = create_engine(url=settings.SQLALCHEMY_DB_URI, pool_size=5, max_overflow=10, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='READ COMMITTED', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
new_engine = create_engine(url=settings.SQLALCHEMY_DB_URI, pool_size=10, max_overflow=20, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='READ COMMITTED', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
||||||
|
|
||||||
current_db.engine = new_engine
|
current_db.engine = new_engine
|
||||||
log.info(f'Created and connected to database: {settings.SQLALCHEMY_DB_URI}')
|
log.info(f'Created and connected to database: {settings.SQLALCHEMY_DB_URI}')
|
||||||
|
|||||||
Reference in New Issue
Block a user