Module Expr Str Assign NameStore Str Import alias Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Str Str Expr Call AttributeLoad NameLoad attr Str NameLoad Str Expr Call AttributeLoad NameLoad attr Str NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str BinOpBitOr BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad NameLoad body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body If CompareIs NameLoad NameLoad body Return If NameLoad body For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Print Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr If BoolOpAnd CompareIsNot NameLoad NameLoad CompareNotEq NameLoad Call NameLoad NameLoad body Print BinOpMod Str NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Break Assign AttributeStore NameLoad attr NameLoad If NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr Index Num attr For NameStore Call AttributeLoad NameLoad attr body For NameStore Call AttributeLoad NameLoad attr body Assign NameStore ListLoad For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return Assign NameStore Dict Assign NameStore NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad ListLoad attr NameLoad If CompareGt Call NameLoad NameLoad Num body For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If UnaryOpNot NameLoad body Continue Expr Call AttributeLoad NameLoad attr Print BinOpMod Str NameLoad Expr Call NameLoad NameLoad orelse Expr Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body If CompareLt Call NameLoad NameLoad Num body Raise Call AttributeLoad NameLoad attr Str TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Str Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Pass If Call AttributeLoad AttributeLoad NameLoad attr attr body If AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str AttributeLoad NameLoad attr orelse Assign NameStore BinOpMod Str SubscriptLoad NameLoad Index Num Assign NameStore BinOpAdd BinOpMult Str BinOpSub Call NameLoad NameLoad Num Str orelse Assign NameStore NameStore Str Assign NameStore ListLoad NameLoad FunctionDef arguments args defaults body While NameLoad body TryExcept body Assign NameStore IfExp SubscriptLoad NameLoad Index Num NameLoad NameLoad Assign SubscriptStore NameLoad Index Num NameLoad Expr Yield Call AttributeLoad Call NameLoad NameLoad attr AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Print Return decorator_list With Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num keyword AttributeLoad NameLoad attr NameStore body For NameStore Call AttributeLoad NameLoad attr Call NameLoad body Assign SubscriptStore NameLoad Index Num NameLoad Assign NameStore Call NameLoad NameLoad TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Print Str Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr
N/A N/A Commandline MySQL client that supports sharded databases.

Usage:
  sql.py <dbspec>

Example dbspecs:
  localhost:root::test
  dbhost:root:pfile=.passwordfile:dbname:12345  # port number
  socket=/var/lib/mysql.sock:root:pfile=/dev/null:dbname

This extends SQL syntax by adding support for:
  -- Output as comma-separated values.
  CSV SELECT * FROM foo;
 N/A __author__ flamingcow@google.com (Ian Gulliver) N/A atexit N/A csv N/A os N/A re N/A readline N/A sys N/A gflags pylib app pylib db N/A FLAGS N/A gflags FLAGS N/A N/A N/A gflags DEFINE_string charset utf8 Input/output character set N/A N/A N/A gflags DEFINE_string prompt None Custom prompt instead of the dbspec N/A N/A N/A gflags DEFINE_boolean print_field_names True Print field names to CSV and stdout. N/A _CSV_RE N/A N/A re compile ^\s*CSV\s+(?P<query>.*)$ N/A N/A N/A re IGNORECASE N/A re DOTALL N/A re MULTILINE _Encode N/A N/A value N/A N/A N/A N/A isinstance value unicode N/A N/A N/A N/A value encode N/A FLAGS charset N/A N/A value N/A _ShowTable N/A N/A result N/A N/A N/A N/A result None N/A N/A N/A result N/A N/A row N/A N/A result GetTable N/A FLAGS print_field_names N/A N/A N/A _Encode row N/A rowcount N/A N/A result GetRowsAffected N/A N/A N/A rowcount None N/A rowcount N/A len result N/A N/A N/A %d row(s) affected rowcount N/A CancellableExecutor N/A object N/A N/A This class helps executing a single query and cancelling it.

  Properties:
    dbh: A database connection as per db.Connect().
    ongoing_operation: A db.Operation representing the latest Execute() call.
   __init__ N/A N/A self dbh N/A N/A N/A Builds a new instance.

    Args:
      dbh: A database connection as per db.Connect().
     N/A N/A self dbh dbh N/A N/A self ongoing_operation None N/A CancelOngoingOperation N/A N/A self N/A N/A N/A N/A self ongoing_operation N/A N/A N/A N/A N/A self dbh Cancel N/A self ongoing_operation N/A N/A self ongoing_operation None N/A Execute N/A N/A self query N/A N/A N/A Executes the query and displays the results on screen. N/A csvh None N/A csv_match N/A N/A _CSV_RE match query N/A csv_match N/A N/A csvh N/A N/A csv writer N/A sys stdout N/A query N/A N/A csv_match group query N/A N/A self ongoing_operation N/A N/A N/A self dbh Submit query N/A results N/A N/A N/A self dbh Wait N/A self ongoing_operation N/A N/A key values N/A N/A results items N/A N/A value values N/A N/A N/A results N/A key value N/A N/A N/A self ongoing_operation None N/A csvh N/A N/A N/A FLAGS print_field_names N/A N/A N/A N/A csvh writerow N/A N/A N/A N/A N/A results values N/A 0 GetFields N/A result N/A N/A results itervalues N/A N/A row N/A N/A result GetRows N/A N/A fields N/A N/A field row N/A N/A N/A isinstance field unicode N/A N/A N/A N/A fields append N/A N/A field encode N/A FLAGS charset N/A N/A N/A N/A fields append field N/A N/A N/A csvh writerow fields N/A N/A by_result N/A N/A result None N/A N/A name result N/A N/A results iteritems N/A N/A N/A N/A N/A N/A by_result setdefault result N/A append name N/A N/A N/A len by_result 1 N/A N/A N/A result names N/A N/A by_result iteritems N/A N/A N/A result N/A N/A N/A N/A N/A names sort N/A N/A %s: names N/A N/A _ShowTable result N/A N/A N/A _ShowTable result N/A N/A Execute N/A N/A dbh query N/A N/A N/A executor N/A CancellableExecutor dbh N/A N/A N/A executor Execute query N/A main N/A N/A argv N/A N/A N/A N/A N/A len argv 2 N/A N/A N/A N/A app UsageError Please specify a dbspec N/A N/A N/A histfile N/A N/A N/A os path join N/A N/A os environ N/A HOME .mysql_history N/A N/A N/A readline read_history_file histfile N/A N/A N/A atexit register N/A readline write_history_file histfile N/A N/A N/A N/A KeyError IOError N/A N/A N/A N/A N/A N/A sys stdin isatty N/A N/A N/A FLAGS prompt N/A N/A prompt N/A %s>  N/A FLAGS prompt N/A N/A prompt N/A %s>  N/A argv N/A 1 N/A continued_prompt N/A N/A N/A N/A len prompt 3 ->  N/A N/A prompt continued_prompt N/A continued N/A False GetLines N/A N/A N/A N/A N/A True N/A N/A N/A N/A display_prompt N/A N/A continued N/A 0 continued_prompt prompt N/A N/A continued N/A 0 True N/A N/A N/A N/A N/A raw_input display_prompt decode N/A FLAGS charset N/A N/A N/A EOFError N/A N/A N/A N/A N/A N/A N/A db Connect N/A argv N/A 1 charset N/A FLAGS charset dbh N/A N/A statement N/A N/A db XCombineSQL N/A GetLines N/A N/A N/A continued N/A 0 False N/A executor N/A CancellableExecutor dbh N/A N/A N/A N/A N/A executor Execute statement N/A N/A N/A KeyboardInterrupt N/A N/A Cancelling current query. Hitting ^C again will terminate the program. N/A N/A N/A executor CancelOngoingOperation N/A N/A N/A __name__ __main__ N/A N/A N/A N/A app run