sqlvalidator icon indicating copy to clipboard operation
sqlvalidator copied to clipboard

validate() missing 1 required positional argument: 'known_fields'

Open timotta opened this issue 2 years ago • 3 comments

Using python 3.9 and sqlvalidator==0.0.18

When running sqlvalidator.parse(query).is_valid() i'm getting

    def _validate(self):
        self.validated = True
        try:
>           self.errors = self.sql_query.validate()
E           TypeError: validate() missing 1 required positional argument: 'known_fields'

The class of self.sql_query is WithStatement

timotta avatar Mar 23 '22 14:03 timotta

Hey @timotta

Thanks for opening an issue.

What's the content of the query variable? :) So that I can reproduce the issue

David-Wobrock avatar Mar 23 '22 15:03 David-Wobrock

I am getting similar issue. When I am validating the query using WITH to create an alias, then it is giving this error

vchauhan-ai avatar Aug 02 '22 19:08 vchauhan-ai

I get this error when attempting to use WITH AS as well.

Example

with cte as (select * from a)
select * from cte

MilesMartinez avatar Feb 14 '23 21:02 MilesMartinez