将 postgres 与 sqlalchemy 连接到一个不和谐的机器人

时间:2021-07-10 21:36:28

标签: python postgresql sqlalchemy

我试图运行一个不和谐的机器人,但我坚持在数据库中运行,我无法解决这个问题

import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker

from inhouse_bot.database_orm import bot_declarative_base 
import sqlalchemy


def migrate():
    # TODO This should be removed in favor of a true database migration tool like Alembic

    # We create the engine to connect to the database
    engine = sqlalchemy.create_engine(os.environ["postgresql+psycopg2://postgres:password@localhost:5432/yohouse-yodismo"])

当我运行机器人时会出现:

"KeyError: 'postgresql+psycopg2://postgres:password@localhost:5432/yohouse-yodismo' "

0 个答案:

没有答案