dql.cli module

Interative DQL client

class dql.cli.DQLClient(completekey='tab', stdin=None, stdout=None)[source]

Bases: cmd.Cmd

Interactive commandline interface.

Attributes:
running : bool

True while session is active, False after quitting

engine : dql.engine.FragmentEngine
caution_callback(action)[source]

Prompt user for manual continue when doing write operation on all items in a table

complete_file(text, line, *_)[source]

Autocomplete DQL file lookup

complete_ls(text, *_)[source]

Autocomplete for ls

complete_opt(text, line, begidx, endidx)[source]

Autocomplete for options

complete_opt_allow_select_scan(text, *_)[source]

Autocomplete for allow_select_scan option

complete_opt_display(text, *_)[source]

Autocomplete for display option

complete_opt_format(text, *_)[source]

Autocomplete for format option

complete_opt_lossy_json_float(text, *_)[source]

Autocomplete for lossy_json_float option

complete_opt_pagesize(*_)[source]

Autocomplete for pagesize option

complete_opt_width(*_)[source]

Autocomplete for width option

complete_use(text, *_)[source]

Autocomplete for use

complete_watch(text, *_)[source]

Autocomplete for watch

completedefault(text, line, *_)[source]

Autocomplete table names in queries

default(command)[source]

This is an override of super class method.

do_EOF()[source]

Exit

do_exit()[source]

Exit

do_file(filename)[source]

Read and execute a .dql file

do_local(host='localhost', port=8000)[source]

Connect to a local DynamoDB instance. Use ‘local off’ to disable.

> local > local host=localhost port=8001 > local off

do_ls(table: str = None) → None[source]

List all tables or print details of one table

do_opt(*_args, **kwargs)[source]

Get and set options

do_shell(arglist)[source]

Run a shell command

do_throttle(*_args)[source]

Set the allowed consumed throughput for DQL.

# Set the total allowed throughput across all tables > throttle 1000 100 # Set the default allowed throughput per-table/index > throttle default 40% 20% # Set the allowed throughput on a table > throttle mytable 10 10 # Set the allowed throughput on a global index > throttle mytable myindex 40 6

see also: unthrottle

do_unthrottle(*args)[source]

Remove the throughput limits for DQL that were set with ‘throttle’

# Remove all limits > unthrottle # Remove the limit on total allowed throughput > unthrottle total # Remove the default limit > unthrottle default # Remove the limit on a table > unthrottle mytable # Remove the limit on a global index > unthrottle mytable myindex

do_use(region)[source]

Switch the AWS region

> use us-west-1 > use us-east-1

do_watch(*args)[source]

Watch Dynamo tables consumed capacity

emptyline()[source]

Called when an empty line is entered in response to the prompt.

If this method is not overridden, it repeats the last nonempty command entered.

formatter = None[source]
getopt_default(option)[source]

Default method to get an option

getopt_display()[source]

Get value for display option

getopt_format()[source]

Get value for format option

help_alter()[source]

Print the help text for ALTER

help_analyze()[source]

Print the help text for ANALYZE

help_create()[source]

Print the help text for CREATE

help_delete()[source]

Print the help text for DELETE

help_drop()[source]

Print the help text for DROP

help_dump()[source]

Print the help text for DUMP

help_explain()[source]

Print the help text for EXPLAIN

help_help()[source]

Print the help text for help

help_insert()[source]

Print the help text for INSERT

help_load()[source]

Print the help text for LOAD

help_opt()[source]

Print the help text for options

help_scan()[source]

Print the help text for SCAN

help_select()[source]

Print the help text for SELECT

help_update()[source]

Print the help text for UPDATE

initialize(region: str = 'us-west-1', host: str = None, port: int = 8000, config_dir: Optional[str] = None, session: Optional[Any] = None) → None[source]

Set up the repl for execution.

load_config()[source]

Load your configuration settings from a file

opt_allow_select_scan(allow)[source]

Set option allow_select_scan

opt_display(display)[source]

Set value for display option

opt_format(fmt)[source]

Set value for format option

opt_lossy_json_float(lossy)[source]

Set option lossy_json_float

opt_pagesize(pagesize)[source]

Get or set the page size of the query output

opt_width(width)[source]

Set width of output (‘auto’ will auto-detect terminal width)

postcmd(stop, line)[source]

Hook method executed just after a command dispatch is finished.

run_command(command: str, use_json: bool = False, raise_exceptions: bool = False) → None[source]

Run a command passed in from the command line with -c

running = False[source]
save_config()[source]

Save the conf file

session = None[source]
start()[source]

Start running the interactive session (blocking)

update_prompt()[source]

Update the prompt

dql.cli.exception_handler(engine)[source]

It is a context manager which can handle exceptions and deal with them.

dql.cli.get_enum_key(key, choices)[source]

Get an enum by prefix or equality

dql.cli.indent(string, prefix=' ')[source]

Indent a paragraph of text

dql.cli.prompt(msg, default=<object object>, validate=None)[source]

Prompt user for input

dql.cli.promptyn(msg, default=None)[source]

Display a blocking prompt until the user confirms

dql.cli.repl_command(fxn)[source]

Decorator for cmd methods

Parses arguments from the arg string and passes them to the method as *args and **kwargs.