Пример #1
0
group.add_argument('-D',
                   '--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=[sys.stdin],
    help='the path to the file containing the SQL query to execute (default: '
    'standard input)',
    type=argparse.FileType('r'),
    nargs='*')
parser.add_argument(
    '-s',
Пример #2
0
    '--default',
    default=True,
    help='output format: human readable hierarchical text',
    dest='formatter',
    action='store_const',
    const=ArgumentWriter)
group.add_argument(
    '-V',
    help='output format: better readable text',
    dest='formatter',
    action='store_const',
    const=ArgumentVerboseWriter)

parser = create_parser(
    prog='dbargs',
    description='A tool to convert YAML config files to db{graph,export,nav} '
                'command line arguments',
    parents=[parent])
parser.add_argument(
    'infile',
    default='-',
    help='the path to the file containing the YAML config to convert',
    type=argparse.FileType('r'),
    nargs='?')
parser.add_argument(
    '-i',
    '--includes',
    default=True,
    dest='includes',
    action='store_true',
    help='show includes in output')
Пример #3
0
                   const=SimpleWriter)
group.add_argument('-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='dbmanagr',
    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')
parser.add_argument('-N',
                    '--no-simplify',
Пример #4
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 dbmanagr.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'
)
Пример #5
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='dbmanagr',
    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')
Пример #6
0
                   '--default',
                   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 '
Пример #7
0
group.add_argument('-Y',
                   '--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', '--exclude', help='exclude specified columns')
parser.add_argument(
    '-s',
Пример #8
0
group.add_argument('-D',
                   '--default',
                   default=True,
                   help='output format: human readable hierarchical text',
                   dest='formatter',
                   action='store_const',
                   const=ArgumentWriter)
group.add_argument('-V',
                   help='output format: better readable text',
                   dest='formatter',
                   action='store_const',
                   const=ArgumentVerboseWriter)

parser = create_parser(
    prog='dbargs',
    description='A tool to convert YAML config files to db{graph,export,nav} '
    'command line arguments',
    parents=[parent])
parser.add_argument(
    'infile',
    default='-',
    help='the path to the file containing the YAML config to convert',
    type=argparse.FileType('r'),
    nargs='?')
parser.add_argument('-i',
                    '--includes',
                    default=True,
                    dest='includes',
                    action='store_true',
                    help='show includes in output')
parser.add_argument('-I',
Пример #9
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='dbstac',
    description='Lists the statements and transactions currently active in '
                'the DBMS.',
    parents=[parent])
parser.add_argument(
    'uri',
    help='the URI to a DBMS')
parser.add_argument(
    'pattern',
    default=None,
    help='shows only queries that match the pattern (default: no pattern)',
    nargs='?')
parser.add_argument(
    '-u',
    '--username',
    default='',
    help='filter the user')
Пример #10
0
    '--graphviz',
    help='output format: a Graphviz graph',
    dest='formatter',
    action='store_const',
    const=GraphvizWriter)
group.add_argument(
    '-Y',
    '--yaml',
    help='output format: the graph in YAML format',
    dest='formatter',
    action='store_const',
    const=YamlWriter)

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',
Пример #11
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 '
Пример #12
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=[sys.stdin],
    help='the path to the file containing the SQL query to execute (default: '
         'standard input)',
    type=argparse.FileType('r'),
    nargs='*')
parser.add_argument(
    '-s',
Пример #13
0
group.add_argument('-G',
                   '--graphviz',
                   help='output format: a Graphviz graph',
                   dest='formatter',
                   action='store_const',
                   const=GraphvizWriter)
group.add_argument('-Y',
                   '--yaml',
                   help='output format: the graph in YAML format',
                   dest='formatter',
                   action='store_const',
                   const=YamlWriter)

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',
                    '--no-columns',
                    dest='include_columns',
Пример #14
0
# -*- coding: utf-8 -*-
#
# Copyright © 2014 René Samselnig
#
# 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 dbmanagr.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")
Пример #15
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='dbstac',
    description='Lists the statements and transactions currently active in '
    'the DBMS.',
    parents=[parent])
parser.add_argument('uri', help='the URI to a DBMS')
parser.add_argument(
    'pattern',
    default=None,
    help='shows only queries that match the pattern (default: no pattern)',
    nargs='?')
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 '
Пример #16
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',