MyManager - create_conn() - allow same parameters as for PgManager.
--- 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)
--- 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()