예제 #1
0
    '--default',
    help='output format: tuples',
    dest='formatter',
    action='store_const',
    const=ExecuteWriter)
group.add_argument(
    '-I',
    '--insert',
    help='output format: SQL insert statements',
    dest='formatter',
    action='store_const',
    const=SqlInsertWriter)

parser = create_parser(
    prog='dbexec',
    description='Executes the SQL statements from the given file on the '
                'database specified by the given URI',
    parents=[parent])
parser.add_argument(
    'uri',
    help='the URI to parse (format for PostgreSQL/MySQL: user@host/database; '
         'for SQLite: databasefile.db)')
parser.add_argument(
    'infile',
    default='-',
    help='the path to the file containing the SQL query to execute',
    type=argparse.FileType('r'),
    nargs='?')
parser.add_argument(
    '-s',
    '--statements',
예제 #2
0
from .writer import StatementActivityWriter

parent = parent_parser()

group = format_group(parent)
group.add_argument(
    '-D',
    '--default',
    help='output format: default',
    dest='formatter',
    action='store_const',
    const=StatementActivityWriter)

parser = create_parser(
    prog='dbstat',
    description='A database status tool',
    parents=[parent])
parser.add_argument(
    'uri',
    help='the URI to a DBMS')
parser.add_argument(
    '-u',
    '--username',
    default='',
    help='filter the user')
parser.add_argument(
    '-p',
    '--pids',
    action=CommaSeparatedPlainList,
    default=-1,
    help='filter the process ids of the activity; multiple columns can be '
예제 #3
0
    '--yaml',
    help='output format: YAML data',
    dest='formatter',
    action='store_const',
    const=YamlWriter)
group.add_argument(
    '-F',
    '--formatted',
    help='output format: given with the -f/--format option',
    dest='formatter',
    action='store_const',
    const=FormattedWriter)

parser = create_parser(
    prog='dbexport',
    description='An export tool that exports database rows in different '
                'formats.',
    parents=[parent])
parser.add_argument(
    'uri',
    help='the URI to parse (format for PostgreSQL/MySQL: '
         'user@host/database/table?column=value; for SQLite: '
         'databasefile.db/table?column=value)')
parser.add_argument(
    '-i',
    '--include',
    help='include specified columns; referenced rows, if any, can be included '
         'by adding a dot after the column name; multiple columns can be '
         'specified by separating them with a comma')
parser.add_argument(
    '-x',
예제 #4
0
    '-J',
    '--json',
    help='output format: JSON',
    dest='formatter',
    action='store_const',
    const=JsonWriter)
group.add_argument(
    '-A',
    '--autocomplete',
    help='output format: autocomplete',
    dest='formatter',
    action='store_const',
    const=AutocompleteWriter)
parser = create_parser(
    prog='dbnav',
    description='A database navigation tool that shows database structure and'
                ' content',
    parents=[parent])
parser.add_argument(
    'uri',
    help='the URI to parse (format for PostgreSQL/MySQL: '
         'user@host/database/table?filter; for SQLite: '
         'databasefile.db/table?filter)',
    nargs='?')
parser.add_argument(
    '-s',
    '--simplify',
    dest='simplify',
    default=True,
    help='simplify the output',
    action='store_true')
예제 #5
0
    default=True,
    help='output format: human readable hierarchical text',
    dest='formatter',
    action='store_const',
    const=DiffWriter)
group.add_argument(
    '-S',
    '--side-by-side',
    help='output format: compare side-by-side in two columns',
    dest='formatter',
    action='store_const',
    const=DiffColumnWriter)

parser = create_parser(
    prog='dbdiff',
    description='A diff tool that compares the structure of two database '
                'tables with each other.',
    parents=[parent])
parser.add_argument(
    'left',
    help='the left URI to parse (format for PostgreSQL/MySQL: '
         'user@host/database/table; for SQLite: databasefile.db/table)')
parser.add_argument(
    'right',
    help='the right URI to parse (format for PostgreSQL/MySQL: '
         'user@host/database/table; for SQLite: databasefile.db/table)')
parser.add_argument(
    '-v',
    '--verbose',
    action='count',
    help='specify the verbosity of the output, increase the number of '
예제 #6
0
#
# This file is part of Database Navigator.
#
# Database Navigator is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Database Navigator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Database Navigator.  If not, see <http://www.gnu.org/licenses/>.
#

from dbnav.args import parent_parser, create_parser

parent = parent_parser(daemonable=True, daemon=True)

parser = create_parser(
    prog='dbdaemon',
    description='The daemon background process.',
    parents=[parent])
parser.add_argument(
    'command',
    choices=['start', 'stop', 'restart', 'status'],
    help='the command to issue'
)
예제 #7
0
    default=True,
    help='output format: human readable hierarchical text',
    dest='formatter',
    action='store_const',
    const=GraphWriter)
group.add_argument(
    '-G',
    '--graphviz',
    help='output format: a Graphviz graph',
    dest='formatter',
    action='store_const',
    const=GraphvizWriter)

parser = create_parser(
    prog='dbgraph',
    description='A database visualisation tool that creates graphs from the '
                'database structure',
    parents=[parent])
parser.add_argument(
    'uri',
    help='the URI to parse (format for PostgreSQL/MySQL: '
         'user@host/database/table; for SQLite: databasefile.db/table)')
parser.add_argument(
    '-c',
    '--columns',
    dest='include_columns',
    default=False,
    help='include columns in output',
    action='store_true')
parser.add_argument(
    '-C',