lelit/pglast

Unable to create Expr instances with params

Closed this issue · 2 comments

pglast.ast.SubLink(
                {
                    "@": "SubLink",
                    "subLinkType": pglast.enums.SubLinkType.ANY_SUBLINK,
                    "testexpr": pglast.ast.ColumnRef(
                        {
                            "@": "ColumnRef",
                            "fields": (
                                pglast.ast.String({"@": "String", "val": "tab"}),
                                pglast.ast.String({"@": "String", "val": "_id"}),
                            ),
                        }
                    ),
                    "subselect": where_in_sel,
                }
)

Raises

File "../venv/lib/python3.8/site-packages/pglast/ast.py", line 3394, in __init__
    super().__init__(subLinkType)
TypeError: __init__() takes 1 positional argument but 2 were given

There is a second definition of Expr with __init__ taking no parameters, removing this seems to fix the problem.

class Expr(Node):

lelit commented

Thank you, good catch! I will address this in the following days.

lelit commented

This is fixed in the upcoming v3.8.