-
-
Notifications
You must be signed in to change notification settings - Fork 873
Description
Search before asking
- I searched the issues and found no similar issues.
What Happened
I wanted to test some files slightly larger than the default limit so set the option large_file_skip_byte_limit = 0
then ran a !sqlfluff parse
on the files.
Expected Behaviour
I would expect it to then properly parse those files, perhaps taking a bit long.
Observed Behaviour
Instead I got an error message of TypeError: '>' not supported between instances of 'int' and 'str'
, located on the file https://github.com/sqlfluff/sqlfluff/blob/main/src/sqlfluff/core/linter/linter.py, line 133.
I checked this file in the repository and it shows that the OS immediately gets both values. In my current configuration I cannot edit this code for myself, but I suspect that line 129, limit = file_config.get("large_file_skip_byte_limit")
, returns a string which should be cast to int before being compared. A quick look at the getter code in https://github.com/sqlfluff/sqlfluff/blob/main/src/sqlfluff/core/config/fluffconfig.py line 520 confirms that this code doesn't do any type casting. A simple solution to this issue would be to change line 133 to if file_size > int(limit):
How to reproduce
To reproduce, simply set this option, large_file_skip_byte_limit, to anything, then do any parse command.
Dialect
I used the databricks dialect
Version
I used sqlfluff version 3.4.0 and python version 3.11.10
Configuration
A configuration sufficient for reproduction is this:
[sqlfluff]
large_file_skip_byte_limit = 0 #increased from 20000 because a few files were a bit larger than the limit
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct