Skip to content

Instantly share code, notes, and snippets.

@krallin
Created February 19, 2015 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krallin/915c33b7091375ee336b to your computer and use it in GitHub Desktop.
Save krallin/915c33b7091375ee336b to your computer and use it in GitHub Desktop.
debug-scalr-remote-ip
#!/opt/scalr-server/embedded/bin/python
import yaml
import pymysql
QUERY = "SELECT * FROM messages WHERE type='in' AND message_name='Hello';"
def main():
with open("/opt/scalr-server/etc/scalr/config.yml") as f:
conf = yaml.load(f)
my = conf["scalr"]["connections"]["mysql"]
db = pymysql.connect(my["host"], my["user"], my["pass"], my["name"], my["port"])
c = db.cursor()
c.execute(QUERY)
for row in c.fetchall():
print row
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment