squabble icon indicating copy to clipboard operation
squabble copied to clipboard

Issue with latest version of pglast

Open grawlinson opened this issue 2 years ago • 1 comments

I was attempting to use the latest version of pglast with squabble, as the specified version of pglast was released back in 2019.

Keep getting these particular errors (see last line):

$ squabble --list-rules
Traceback (most recent call last):
  File "/usr/bin/squabble", line 33, in <module>
    sys.exit(load_entry_point('squabble==1.4.0', 'console_scripts', 'squabble')())
  File "/usr/lib/python3.9/site-packages/squabble/__main__.py", line 12, in main
    status = cli.main()
  File "/usr/lib/python3.9/site-packages/squabble/cli.py", line 45, in main
    return dispatch_args(args)
  File "/usr/lib/python3.9/site-packages/squabble/cli.py", line 75, in dispatch_args
    rule.load_rules(plugin_paths=base_config.plugins)
  File "/usr/lib/python3.9/site-packages/squabble/rule.py", line 59, in load_rules
    _load_builtin_rules()
  File "/usr/lib/python3.9/site-packages/squabble/rule.py", line 51, in _load_builtin_rules
    importlib.import_module('squabble.rules.' + mod_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/squabble/rules/disallow_float_types.py", line 28, in <module>
    class DisallowFloatTypes(BaseRule):
  File "/usr/lib/python3.9/site-packages/squabble/rules/disallow_float_types.py", line 48, in DisallowFloatTypes
    _INEXACT_TYPES = set(
  File "/usr/lib/python3.9/site-packages/squabble/rules/disallow_float_types.py", line 49, in <genexpr>
    _parse_column_type(ty)
  File "/usr/lib/python3.9/site-packages/squabble/rules/disallow_float_types.py", line 25, in _parse_column_type
    return format_type_name(type_name)
  File "/usr/lib/python3.9/site-packages/squabble/util.py", line 39, in format_type_name
    return '.'.join([p.string_value for p in type_name.names])
  File "/usr/lib/python3.9/site-packages/squabble/util.py", line 39, in <listcomp>
    return '.'.join([p.string_value for p in type_name.names])
  File "/usr/lib/python3.9/site-packages/pglast/node.py", line 190, in __getattr__
    value = getattr(self.ast_node, attr)
AttributeError: 'String' object has no attribute 'string_value'

grawlinson avatar Nov 13 '21 07:11 grawlinson

Looks like there have been some pretty significant changes recently in pglast based on the ChangeLog, with several of them being backward incompatible. This project would need to be updated to reflect the new API to use it.

Which features of the new version of pglast are you interested in?

erik avatar Nov 13 '21 09:11 erik