diff --git a/bot_bde/__init__.py b/bot_bde/__init__.py index 3aed77b..4654440 100644 --- a/bot_bde/__init__.py +++ b/bot_bde/__init__.py @@ -1,4 +1,5 @@ from bot_bde.config import config +import db from discord.ext import commands bot = commands.Bot(command_prefix=config.get("prefix")) diff --git a/config_exemple.json b/config_exemple.json index 9d20d7a..8fc5dd5 100644 --- a/config_exemple.json +++ b/config_exemple.json @@ -1 +1,5 @@ -{"prefix": "!", "token": "GOOD_BOT_TOKEN", "admin_id": 1234567890} \ No newline at end of file +{"prefix": "!", + "token": "GOOD_BOT_TOKEN", + "admin_id": 1234567890, + "db": "postgresql://usr:pass@localhost:5432/sqlalchemy" +} \ No newline at end of file diff --git a/db/__init__.py b/db/__init__.py new file mode 100644 index 0000000..d414ccb --- /dev/null +++ b/db/__init__.py @@ -0,0 +1,9 @@ +from bot_bde.config import config +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.declarative import declarative_base +engine = create_engine(config.get("db")) +Session = sessionmaker(bind=engine) +Base = declarative_base() +#from db.foo import Barr +Base.metadata.create_all(engine) diff --git a/requirements.txt b/requirements.txt index 1f29153..97bdd79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ idna==2.9 multidict==4.7.5 websockets==8.1 yarl==1.4.2 +SQLAlchemy~=1.3.17