Skip to content

Instantly share code, notes, and snippets.

@charlycoste
Created May 22, 2013 16:15
Show Gist options
  • Save charlycoste/5628858 to your computer and use it in GitHub Desktop.
Save charlycoste/5628858 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import _mysql
import sys
con = ""
try:
con = _mysql.connect( host='mysql.ebi.ac.uk',
port=4085,
user='go_select',
passwd='amigo',
db='go_latest')
con.query("""SELECT DISTINCT descendant.acc, descendant.name, descendant.term_type
FROM
term
INNER JOIN graph_path ON (term.id=graph_path.term1_id)
INNER JOIN term AS descendant ON (descendant.id=graph_path.term2_id)
WHERE term.name='nucleus' AND distance <> 0 ;""")
result = con.use_result()
print "MySQL version: %s" % \
result.fetch_row()
except _mysql.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit(1)
finally:
if con:
con.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment