Created
November 4, 2015 19:37
-
-
Save tonytan4ever/f9e8fb8bc86bc9edbb8b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
"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