ipython-sql
ipython-sql copied to clipboard
Pretty table config is deprecated and it causes an error of `KeyError: "DEFAULT"`
https://github.com/catherinedevlin/ipython-sql/blob/eb274844b4a619463149e0d57df705e1bba47635/src/sql/run.py#L116C63-L116C74
description in https://github.com/catherinedevlin/ipython-sql/blob/eb274844b4a619463149e0d57df705e1bba47635/src/sql/run.py#L116C63-L116C74 it'd relying on old values which were deprecated in https://github.com/prettytable/prettytable/commit/c280f5db3889e5e7857661d6e42dd07c8d7a6d77#diff-a23434b1b73f48b3a86c77a98ace18042f475a7463f98eea9d2ccf7523e6046dL13 (see https://github.com/prettytable/prettytable/releases)
few possible solutions:
- change to
self.pretty = PrettyTable(self.field_names, style=prettytable.__dict__[f"_DEPRECATED_{config.style.upper()}]) - freeze prettytable to 3.11 in https://github.com/catherinedevlin/ipython-sql/blob/eb274844b4a619463149e0d57df705e1bba47635/requirements.txt#L1
The proposed change works. And it is a very frustrating bug that breaks the basic functionality
Can you merge this then ?
I'm seeing this too. It's breaking where its accessing the style selected as a dictionary key, in the toplevel object. The KeyError changes based on style you select as well. I could fix it again....
Appears to be line 116 of run.py at HEAD. It appears constants related to style have moved to a class called TableStyle as static members.
self.pretty = PrettyTable(self.field_names, style=prettytable.TableStyle.dict[config.style.upper()])
Should probably fix it.