diff.py
changeset 5 57cf8fdff5ed
parent 4 80634cb1c65b
child 6 4ab077c93b2d
--- a/diff.py	Wed Jul 20 10:51:18 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#!/usr/bin/env python3.2
-
-import sys
-import argparse
-
-from pgtools import pgmanager, pgbrowser, pgdiff
-from common import config
-
-parser = argparse.ArgumentParser(description='Database schema diff.')
-parser.add_argument('source', metavar='source', type=str, help='Source database')
-parser.add_argument('destination', metavar='destination', type=str, help='Destination database')
-parser.add_argument('-s', dest='schema', nargs='*', help='Schema filter')
-parser.add_argument('-t', dest='table', nargs='*', help='Table filter')
-args = parser.parse_args()
-
-config = config.ConfigParser()
-config.add_argument('databases', type=dict)
-config.add_argument('meta_db')
-config.add_argument('meta_query')
-config.load('pgtoolkit.conf')
-
-pgm = pgmanager.get_instance()
-
-pgm.create_conn(name='meta', dns=config.meta_db)
-
-def build_conn(name, targetname):
-    with pgm.cursor('meta') as curs:
-        curs.execute(config.meta_query, [targetname])
-        row = curs.fetchone_dict()
-        curs.connection.commit()
-        
-        pgm.create_conn(name=name, **row)
-
-build_conn('src', args.source)
-build_conn('dst', args.destination)
-
-pgm.close_conn('meta')
-
-srcbrowser = pgbrowser.PgBrowser(pgm.get_conn('src'))
-dstbrowser = pgbrowser.PgBrowser(pgm.get_conn('dst'))
-
-pgd = pgdiff.PgDiff(srcbrowser, dstbrowser)
-
-if args.schema:
-    pgd.filter_schemas(include=args.schema)
-
-if args.table:
-    pgd.filter_tables(include=args.table)
-
-pgd.print_diff()