Skip to content

function call error handling #44

Description

@mikeoverjet

I tried to dig into the code and find some breadcrumbs but I couldn't get anywhere...

import sqlvalidator

query = 'SELECT * FROM table WHERE cast(start_time as date) > dateadd(year,-3,now());'
sql_query = sqlvalidator.parse(query)
sql_query.is_valid()

raises:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../python-3.9.4/lib/python3.9/site-packages/sqlvalidator/sql_validator.py", line 25, in is_valid
    self._validate()
  File ".../python-3.9.4/lib/python3.9/site-packages/sqlvalidator/sql_validator.py", line 31, in _validate
    self.errors = self.sql_query.validate()
  File ".../python-3.9.4/lib/python3.9/site-packages/sqlvalidator/grammar/sql.py", line 137, in validate
    errors += self.where_clause.validate(known_fields)
  File ".../python-3.9.4/lib/python3.9/site-packages/sqlvalidator/grammar/sql.py", line 272, in validate
    errors += self.value.validate(known_fields)
  File ".../python-3.9.4/lib/python3.9/site-packages/sqlvalidator/grammar/sql.py", line 1439, in validate
    errors += self.value.validate(known_fields)
  File ".../python-3.9.4/lib/python3.9/site-packages/sqlvalidator/grammar/sql.py", line 557, in validate
    errors += a.validate(known_fields)
AttributeError: 'str' object has no attribute 'validate'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions