This repository has been archived on 2023-04-13. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
CloudBot/plugins/dbtest.py
2013-10-09 18:37:24 +13:00

20 lines
No EOL
527 B
Python

from util import hook
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
from sqlalchemy.orm import scoped_session, sessionmaker
def create_tables(metadata):
users_table = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('name', String),
Column('fullname', String),
Column('password', String)
)
users_table.create()
@hook.command
def dbtest(inp, db=None):
metadata = MetaData(db)
create_tables(metadata)
print metadata