Skip to content

Exception build_formatted_time() missing 1 required positional argument: 'dialect' #1897

@conf

Description

@conf

Hello!

mycli started to throw this exception recently after almost any input.

Suggested troubleshooting steps for bug reports

  • Upgraded to the latest mycli if possible.
  • Ran mycli --checkup, if supported.

Expected Behavior

No exception, just the query result.

Actual Behavior

See Steps to Reproduce

Steps to Reproduce

I use MariaDB 11.4, but it probably doesn't matter in this case.

❯ mycli -h localhost -u root -proot
 (none)  localhost> select version();

Unhandled exception in event loop:
  File "/opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/events.py", line 94, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/input/vt100.py", line 162, in callback_wrapper
    callback()
    ~~~~~~~~^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/application/application.py", line 714, in read_from_input_in_context
    context.copy().run(read_from_input)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/application/application.py", line 694, in read_from_input
    self.key_processor.process_keys()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/key_binding/key_processor.py", line 273, in process_keys
    self._process_coroutine.send(key_press)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/key_binding/key_processor.py", line 188, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/key_binding/key_processor.py", line 323, in _call_handler
    handler.call(event)
    ~~~~~~~~~~~~^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 127, in call
    result = self.handler(event)
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/shortcuts/prompt.py", line 824, in _accept_input
    self.default_buffer.validate_and_handle()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/buffer.py", line 1891, in validate_and_handle
    self.append_to_history()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/prompt_toolkit/buffer.py", line 1365, in append_to_history
    self.history.append_string(self.text)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/mycli/packages/ptoolkit/history.py", line 23, in append_string
    if is_password_change(string):
       ~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/mycli/packages/sql_utils.py", line 551, in is_password_change
    stmt_type, _ = classify_sandbox_statement(text)
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/mycli/packages/sql_utils.py", line 489, in classify_sandbox_statement
    tokens = list(sqlglot.tokenize(stripped, dialect='mysql'))
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/sqlglot/__init__.py", line 89, in tokenize
    return Dialect.get_or_raise(read or dialect).tokenize(sql)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/sqlglot/dialects/dialect.py", line 952, in get_or_raise
    result = cls.get(dialect_name.strip())
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/sqlglot/dialects/dialect.py", line 225, in get
    cls._try_load(key)
    ~~~~~~~~~~~~~^^^^^
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/sqlglot/dialects/dialect.py", line 168, in _try_load
    module = importlib.import_module(f"sqlglot.dialects.{key}")
  File "/opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1406, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 759, in exec_module
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
  File "/opt/homebrew/Cellar/mycli/1.72.1_1/libexec/lib/python3.14/site-packages/sqlglot/dialects/mysql.py", line 9, in <module>
    from sqlglot.parsers.mysql import MySQLParser
  File "/private/tmp/sqlglotc_build_6vbysb6i/sqlglot/parsers/mysql.py", line 125, in <module>

Exception build_formatted_time() missing 1 required positional argument: 'dialect'
Press ENTER to continue...
+----------------------------+
| version()                  |
+----------------------------+
| 11.4.8-MariaDB-ubu2404-log |
+----------------------------+

1 row in set
Time: 0.013s
 (none)  localhost>

System

  • mycli version: 1.72.1
  • OS/version: MacOS Tahoe 26.5
"mycli --checkup" output
❯ mycli --checkup

### Key Python dependencies:

cli_helpers version 2.14.0 (latest 2.15.0)
click version 8.3.3 (latest 8.4.1)
prompt_toolkit version 3.0.52 (latest 3.0.52)
pymysql version 1.1.3 (latest 1.2.0)
tabulate version 0.10.0 (latest 0.10.0)

### External executables:

The "less" executable was found — good!
The "fzf" executable was found — good!
The "pygmentize" executable was found — good!

### Environment variables:

The $EDITOR environment variable was set to "nvim" — good!
The $VISUAL environment variable was not set — some functionality will suffer.

### Missing in user ~/.myclirc:

The item:

    [main]
    show_warnings =

The item:

    [main]
    min_completion_trigger =

The item:

    [main]
    prefetch_schemas_mode =

The item:

    [main]
    prefetch_schemas_list =

The item:

    [main]
    destructive_keywords =

The item:

    [main]
    history_file =

The item:

    [main]
    show_favorite_query =

The item:

    [main]
    redirect_format =

The item:

    [main]
    null_string =

The item:

    [main]
    numeric_alignment =

The item:

    [main]
    binary_display =

The item:

    [main]
    post_redirect_command =

The item:

    [main]
    toolbar =

The item:

    [main]
    terminal_tab_title =

The item:

    [main]
    terminal_window_title =

The item:

    [main]
    multiplex_window_title =

The item:

    [main]
    multiplex_pane_title =

The item:

    [main]
    my_cnf_transition_done =

The item:

    [main]
    use_keyring =

The entire section:

    [search]

The entire section:

    [connection]

The entire section:

    [llm]

The entire section:

    [keys]

The item:

    [colors]
    prompt =

The item:

    [colors]
    continuation =

The item:

    [colors]
    output.table-separator =

The item:

    [colors]
    output.status =

The item:

    [colors]
    output.status.warning-count =

The item:

    [colors]
    output.timing =

The item:

    [colors]
    matching-bracket.cursor =

The item:

    [colors]
    matching-bracket.other =

The entire section:

    [init-commands]

The entire section:

    [alias_dsn.init-commands]

For more info on supported features, see the commentary and defaults at:

    * https://github.com/dbcli/mycli/blob/main/mycli/myclirc

Discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions