ipython-sql icon indicating copy to clipboard operation
ipython-sql copied to clipboard

Pretty table config is deprecated and it causes an error of `KeyError: "DEFAULT"`

Open talbarda opened this issue 1 year ago • 4 comments

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:

  1. change to self.pretty = PrettyTable(self.field_names, style=prettytable.__dict__[f"_DEPRECATED_{config.style.upper()}])
  2. freeze prettytable to 3.11 in https://github.com/catherinedevlin/ipython-sql/blob/eb274844b4a619463149e0d57df705e1bba47635/requirements.txt#L1

talbarda avatar Nov 03 '24 16:11 talbarda

The proposed change works. And it is a very frustrating bug that breaks the basic functionality

pavlozt avatar Dec 15 '24 19:12 pavlozt

Can you merge this then ?

talbarda avatar Dec 15 '24 20:12 talbarda

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....

makingglitches avatar Jun 02 '25 14:06 makingglitches

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.

makingglitches avatar Jun 02 '25 15:06 makingglitches