##----mysql----
import MySQLdb
import os
import pandas as pd
from pandas.io import sql
import sqlalchemy

key_file = os.environ['LAV_DIR'] + '/credenza/intertino.json'
cred = []
with open(key_file) as f:
    cred = json.load(f)
cred = cred['mysql']['intertino']
engine = sqlalchemy.create_engine('mysql://'+cred['user']+':'+cred['pass']+'@'+c
red['host']+'/'+cred['db'],echo=False)
conn = engine.connect()
resquare.to_sql('train_series',conn,if_exists='replace',chunksize=100,index_label="row_names")
conn.close()
			

MySQL, postgresql

from cassandra.cluster import Cluster
import json
key_file = os.environ['LAV_DIR'] + '/credenza/intertino.json'
cred = []
with open(key_file) as f:
    cred = json.load(f)
cred = cred['cassandra']
cluster = Cluster([cred['ip']],port=9042)
session = cluster.connect(cred['keyspace'])
##"Create keyspace "+cred['keyspace']+" with replicaton={'class':strategy name,'replication_factor': No of replications on different nodes}"

#session.set_keyspace('users')
rows = session.execute('SELECT name, age, email FROM users')
for user_row in rows:
    print user_row.name, user_row.age, user_row.email

session.execute("""insert into users (lastname, age, city, email, firstname) values ('Jones', 35, 'Austin', 'bob@example.com', 'Bob')""")
result = session.execute("select * from users where lastname='Jones' ")[0]
print result.firstname, result.age
session.execute(
    """
    INSERT INTO users (name, credits, user_id, username)
    VALUES (%(name)s, %(credits)s, %(user_id)s, %(name)s)
    """,
    {'name': "John O'Reilly", 'credits': 42, 'user_id': uuid.uuid1()}
)
			

Scylla, cassandra


##MATCH (n) RETURN (n);
##MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;
CREATE (Entropy:Measure {label:'measure for creativity'})
CREATE (Aere:Song { id:'0', name:'Aere', entropy:'4.962'}), (AjdeJano:Song { id:'1', name:'AjdeJano', entropy:'4.030'}), (BachCiaccona:Song { id:'2', name:'BachCiaccona', entropy:'7.251'}),
CREATE (AjdeJano) - [:DIST{d: 0.470}] -> (Prolecic), (AjdeJano) - [:DIST{d: 0.499}] -> (ReelIrlandais), (BachCiaccona) - [:DIST{d: 0.364}] -> (BertaliSonata1), (BachCiaccona) - [:DIST{d: 0.203}] -> (BlueMonk), (BachCiaccona) - [:DIST{d: 0.377}] -> (CorelliFolia),
RETURN Entropy;
			

Neo4j

Creates a graph database connecting songs by entropy correlation