janaSunrise / overflow-discord-bot

A small bot designed to help you with coding and finding and solving issues faster by integrating stack overflow workflow into discord.
GNU General Public License v3.0
3 stars 2 forks source link

Feature plans for bot. #62

Closed janaSunrise closed 2 years ago

janaSunrise commented 3 years ago

This PR is aimed for adding more features to bot, which is being planned.

Features to be added:

Fixes to be done.

Incomplete - Partially done.

Descriptions

Info about the DB session for every operation:

To create a new session for each task you can use the constructor directly like shown here https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.html#running-synchronous-methods-and-functions-under-asyncio

async with AsyncSession(engine) as session:
        async with session.begin():
            ...

or you can use a sessionmaker as in the example here https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.html#preventing-implicit-io-when-using-asyncsession (in this case you create the session maker only once, not every time)

# sessionmaker version
async_session = sessionmaker(
    engine, expire_on_commit=False, class_=AsyncSession
)

async with async_session() as session:
    ...

These are all planned for now in this PR. More to come.