Skip to content

Instantly share code, notes, and snippets.

@yuriwoof yuriwoof/
Created Dec 31, 2016

What would you like to do?
from sqlalchemy import Column, DateTime, Integer, String
from db import db_session, Base
class Pet(Base):
__tablename__ = 'pets'
id = Column(Integer, primary_key=True)
name = Column(String(100))
tag = Column(String(20))
created = Column(DateTime())
def update(self, id=None, name=None, tag=None, created=None):
if name is not None: = name
if tag is not None:
self.tag = tag
if created is not None:
self.created = created
def as_dict(self):
return dict([(k, v) for k, v in vars(self).items() if not k.startswith('_')])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.