I decided to try and dump the whole database to the simple grid format discussed previously. First I needed a list of tables to dump, and I decided to make this an exercise in learning some Python database API.
Here is a Python program to dump the list of tables in a SQLite database.
#!/usr/bin/python import sys, sqlite3 if len(sys.argv) != 2: print "expected database file name" sys.exit() file = sys.argv[1] conn = sqlite3.connect(file) c = conn.cursor() c.execute('select name from sqlite_master where type=\'table\'') for table in c: print table[0] conn.close()
No comments:
Post a Comment