Skip to content

Instantly share code, notes, and snippets.

@Yepoleb
Created June 7, 2014 16:36
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 Yepoleb/ac9e09a83ba90115fe90 to your computer and use it in GitHub Desktop.
Save Yepoleb/ac9e09a83ba90115fe90 to your computer and use it in GitHub Desktop.
import mysql.connector as mysql
import yaml
filepath = "warps/"
conn = mysql.connect(user="", password="",
host="localhost", database="mc_global_gesuit")
print("Fetching data")
cur = conn.cursor()
cur.execute("SELECT * FROM warps")
warptable = cur.fetchall()
print("Processing data")
warpfiles = []
for row in warptable:
warpname = row[0]
world = row[2]
x = row[3]
y = row[4]
z = row[5]
yaw = row[6]
pitch = row[7]
warpfiles.append({
"world": world,
"x": x,
"y": y,
"z": z,
"yaw": yaw,
"pitch": pitch,
"name": warpname})
print("Dumping warps")
for warp in warpfiles:
warppath = filepath + warp["name"] + ".yml"
f = open(warppath, "w")
yaml.dump(warp, f, default_flow_style=False)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment