Skip to content

Instantly share code, notes, and snippets.

@clutchski
Created November 14, 2009 18:08
Show Gist options
  • Save clutchski/234667 to your computer and use it in GitHub Desktop.
Save clutchski/234667 to your computer and use it in GitHub Desktop.
an example of a caribou migration
"""
an example of a caribou migration
"""
def upgrade(connection):
sql = """
create table animals
( name TEXT
, status TEXT
) """
connection.execute(sql)
animals = [ ('caribou', 'least concerned')
, ('bengal tiger', 'threatened')
, ('eastern elk', 'extinct')
]
sql = 'insert into animals values (:1, :2)
for name, status in animals:
connection.execute(sql, [name, status])
connection.commit()
def downgrade(connection):
connection.execute('drop table animals')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment