Skip to content

unsupported operand type(s) for +: 'String' and 'str' #55

@xdfai4x

Description

@xdfai4x

import sqlvalidator

sql="""
SELECT
"u"."user_id",
"u"."full_name",
"lq"."year",
"lt"."leave_type_name",
"lq"."total_days",
"lq"."used_days",
"lq"."total_days" - "lq"."used_days" AS "remaining_days"
FROM
"user_annual_leave_quota" "lq"
JOIN
"users" "u" ON "lq"."user_id" = "u"."user_id"
JOIN
"leave_types" "lt" ON "lq"."leave_type_id" = "lt"."leave_type_id"
WHERE
"u"."full_name" = '王五'
AND "lq"."year" = 2023
AND "lt"."leave_type_name" = '年假';
"""
validator = sqlvalidator.parse(sql)
print(validator.is_valid())

sample sql can execute successfully on pgsql and got on row result, but when I run these code, I got en exception:
Exception has occurred: TypeError
unsupported operand type(s) for +: 'String' and 'str'
File "D:\homegit\sql_builder_agent\src\sql_validate_test.py", line 26, in
print(validator.is_valid())
^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for +: 'String' and 'str'

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