what am I doing
This commit is contained in:
parent
bdcd4c9ae5
commit
74b6c1f9a7
3 changed files with 39 additions and 9 deletions
20
plugins/dbtest.py
Normal file
20
plugins/dbtest.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
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
|
Reference in a new issue