Skip to content

Instantly share code, notes, and snippets.

@tonytan4ever
Created November 4, 2015 19:37
Show Gist options
  • Save tonytan4ever/f9e8fb8bc86bc9edbb8b to your computer and use it in GitHub Desktop.
Save tonytan4ever/f9e8fb8bc86bc9edbb8b to your computer and use it in GitHub Desktop.
'''
"flavorRef": "http://127.0.0.1:8888/v1.0/000/flavors/standard"
'''
from cassandra.cluster import Cluster
def init_db():
cluster = Cluster(["localhost"])
session = cluster.connect()
session.execute('''
INSERT INTO poppy.flavors (flavor_id,
providers)
VALUES (%(flavor_id)s,
%(providers)s)
''', dict(flavor_id="standard",
providers=dict([("fastly", 'www.fastly.com')])
))
session.execute('''
INSERT INTO poppy.flavors (flavor_id,
providers)
VALUES (%(flavor_id)s,
%(providers)s)
''', dict(flavor_id="premium",
providers=dict([("akamai", 'www.akamai.com')])
))
if __name__ == "__main__":
init_db()
print "Init poppy database complete..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment