diff --git a/app.py b/app.py index 4393442..e1900e8 100644 --- a/app.py +++ b/app.py @@ -7,8 +7,14 @@ import sqlalchemy from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base +Base = declarative_base() + +import models + engine = create_engine( os.environ.get( 'DATABASE_URL', 'sqlite:///:memory:' ), echo=True ) +Base.metadata.create_all( engine ) + app = connexion.App(__name__, specification_dir='./swagger/') app.add_api('swagger.yaml', arguments={ diff --git a/models.py b/models.py new file mode 100644 index 0000000..1d2229a --- /dev/null +++ b/models.py @@ -0,0 +1,15 @@ +from sqlalchemy import Column, Integer, String +from sqlalchemy.ext.declarative import declarative_base + +Base = declarative_base() + +class Duck( Base ): + __tablename__ = 'users' + + duck_id = Column( Integer, primary_key=True ) + name = Column( String ) + color = Column( String ) + + def __repr__(self): + return "" % ( + self.name, self.fullname, self.password)