pgtoolkit/toolbase.py
changeset 83 515fadd3d286
parent 78 64c62ac8f65d
child 84 3b5dd9efba35
equal deleted inserted replaced
82:7b82dc1fb6f5 83:515fadd3d286
     1 import argparse
     1 import argparse
     2 import logging
     2 import logging
     3 import re
     3 import re
     4 
     4 
     5 from pgtoolkit import pgmanager, pgbrowser, configparser
     5 from pycolib.configparser import ConfigParser
     6 from pgtoolkit.coloredformatter import ColoredFormatter
     6 from pycolib.coloredformatter import ColoredFormatter
     7 from pgtoolkit.highlight import highlight
     7 from pycolib.ansicolor import highlight
       
     8 
       
     9 from pgtoolkit import pgmanager, pgbrowser
     8 
    10 
     9 
    11 
    10 class ConnectionInfoNotFound(Exception):
    12 class ConnectionInfoNotFound(Exception):
    11     pass
    13     pass
    12 
    14 
    19     def __init__(self, name, desc, **kwargs):
    21     def __init__(self, name, desc, **kwargs):
    20         self.parser = argparse.ArgumentParser(description=desc)
    22         self.parser = argparse.ArgumentParser(description=desc)
    21         self.parser.add_argument('-d', dest='debug', action='store_true',
    23         self.parser.add_argument('-d', dest='debug', action='store_true',
    22             help='Debug mode - print database queries.')
    24             help='Debug mode - print database queries.')
    23 
    25 
    24         self.config = configparser.ConfigParser()
    26         self.config = ConfigParser()
    25         self.config.add_argument('databases', type=dict)
    27         self.config.add_option('databases', type=dict)
    26         self.config.add_argument('meta_db')
    28         self.config.add_option('meta_db')
    27         self.config.add_argument('meta_query')
    29         self.config.add_option('meta_query')
    28 
    30 
    29         self.pgm = pgmanager.get_instance()
    31         self.pgm = pgmanager.get_instance()
    30         self.target_isolation_level = None
    32         self.target_isolation_level = None
    31 
    33 
    32     def init(self):
    34     def init(self):