Skip to content

NameError: max_example_length is not defined in load_value_examples #13

@j0ker70

Description

@j0ker70

Bug

Running bash script/preprocess.sh on a clean install crashes with:

File "alphasql/database/utils.py", line 160, in load_value_examples
    examples = execute_sql_without_timeout(db_path, f"SELECT DISTINCT `{column_name}` FROM `{table_name}` WHERE `{column_name}` IS NOT NULL AND
`{column_name}` != '' AND length(cast(`{column_name}` as text)) <= {max_example_length} LIMIT {max_num_examples};").result
NameError: name 'max_example_length' is not defined

Root cause

Commit c821bfd ("fix long context issue") added an AND length(cast(... as text)) <= {max_example_length} clause to the SQL f-string in
load_value_examples, but max_example_length was never defined as a parameter, local variable, or module-level constant.

The current function signature is:

def load_value_examples(db_id: str, database_root_dir: str, table_name: str, column_name: str, max_num_examples: int = 3) -> List[str]:

— no max_example_length.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions