Skip to content

Instantly share code, notes, and snippets.

@hub-cap
Created May 1, 2013 15:36
Show Gist options
  • Select an option

  • Save hub-cap/5496028 to your computer and use it in GitHub Desktop.

Select an option

Save hub-cap/5496028 to your computer and use it in GitHub Desktop.
def create_user(self, context, users):
cur = get_engine().cursor()
for item in users:
user = models.MySQLUser()
user.deserialize(item)
cur.execute("CREATE ROLE %s LOGIN PASSWORD '%s'" %
(user.name, user.password))
for database in user.databases:
mydb = models.MySQLDatabase()
mydb.deserialize(database)
cur.execute("CREATE DATABASE %s OWNER %s"
% (mydb.name, user.name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment