Skip to content

Instantly share code, notes, and snippets.

@pcote
Last active March 14, 2016 12:41
Show Gist options
  • Select an option

  • Save pcote/2fe2178765fddef9e067 to your computer and use it in GitHub Desktop.

Select an option

Save pcote/2fe2178765fddef9e067 to your computer and use it in GitHub Desktop.
# set up the connection to an account that has delete permissions.
root_pw = parser["myapplication"]["root_password"]
ct_string = "mysql+pymysql://root:{}@localhost/mydatabase".format(root_pw)
eng = create_engine(ct_string)
conn = eng.connect()
# clear the learning resources
query_string = """delete from resources where id in (
select resource_id from resource_deletions)"""
conn.execute(query_string)
# clear the deletion queue for resources
query_string = "delete from resource_deletions"
conn.execute(query_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment