# HG changeset patch # User Radek Brich # Date 1321868617 -3600 # Node ID cb7e13711a990f892a989b5c31022e9b1988c545 # Parent 93450b43e62746595d2dfd35f1f67e19e4fe85f5 MyManager - create_conn() - allow same parameters as for PgManager. diff -r 93450b43e627 -r cb7e13711a99 mytoolkit/mymanager.py --- a/mytoolkit/mymanager.py Mon Nov 14 18:00:53 2011 +0100 +++ b/mytoolkit/mymanager.py Mon Nov 21 10:43:37 2011 +0100 @@ -93,6 +93,17 @@ self.init_statement = init_statement self.keep_open = keep_open self.parameters = kw + self.adjust_parameters() + + def adjust_parameters(self): + '''Rename Postgres parameters to proper value for MySQL.''' + m = {'dbname' : 'db', 'password' : 'passwd'} + res = dict() + for k, v in list(self.parameters.items()): + if k in m: + k = m[k] + res[k] = v + self.parameters = res class RowDict(dict): @@ -143,7 +154,7 @@ for conn in tuple(self.conn_known.keys()): self.destroy_conn(conn) - def create_conn(self, name='default', isolation_level=None, dsn=None, **kw): + def create_conn(self, name='default', isolation_level=None, **kw): '''Create named connection.''' if name in self.conn_known: raise MyManagerError('Connection name "%s" already registered.' % name) diff -r 93450b43e627 -r cb7e13711a99 schemadiff.py --- a/schemadiff.py Mon Nov 14 18:00:53 2011 +0100 +++ b/schemadiff.py Mon Nov 21 10:43:37 2011 +0100 @@ -9,6 +9,7 @@ self.parser.add_argument('-s', dest='schema', nargs='*', help='Schema filter') self.parser.add_argument('-t', dest='table', nargs='*', help='Table filter') + self.parser.add_argument('--sql', action='store_true', help='Output is SQL script.') self.init() @@ -24,7 +25,10 @@ if self.args.table: pgd.filter_tables(include=self.args.table) - pgd.print_diff() + if self.args.sql: + pgd.print_patch() + else: + pgd.print_diff() tool = SchemaDiffTool()