-
-
Save Kurobyte/4c16a9849af16ad04052 to your computer and use it in GitHub Desktop.
Split PHPMyAdmin export into individual tables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys, re | |
| f = open(sys.argv[1]) | |
| files = f.read().split('-- --------------------------------------------------------') | |
| files.pop(0) | |
| for file in files: | |
| table = re.search('-- .*\`(.*)\`\n--', file).group(1) #Get table name | |
| f = open('./' + table + '.sql', 'w') | |
| f.write(file) | |
| f.close() | |
| print "--- ["+ table + "] table splited ---"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment