Add simple Duck model
This commit is contained in:
parent
039855db6f
commit
70a5a99909
6
app.py
6
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={
|
||||
|
15
models.py
Normal file
15
models.py
Normal file
@ -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 "<User(name='%s', fullname='%s', password='%s')>" % (
|
||||
self.name, self.fullname, self.password)
|
Loading…
Reference in New Issue
Block a user