{"record":{"id":"0419f2dcd30b04ac","repo":"run-llama/llama_index","slug":"ignore-tables-missing-tables-not-found-in-databa","errorCode":null,"errorMessage":"ignore_tables {missing_tables} not found in database","messagePattern":"ignore_tables (.+?) not found in database","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/utilities/sql_wrapper.py","lineNumber":82,"sourceCode":"        # including view support by adding the views as well as tables to the all\n        # tables list if view_support is True\n        self._all_tables = set(\n            self._inspector.get_table_names(schema=schema)\n            + (self._inspector.get_view_names(schema=schema) if view_support else [])\n        )\n\n        self._include_tables = set(include_tables) if include_tables else set()\n        if self._include_tables:\n            missing_tables = self._include_tables - self._all_tables\n            if missing_tables:\n                raise ValueError(\n                    f\"include_tables {missing_tables} not found in database\"\n                )\n        self._ignore_tables = set(ignore_tables) if ignore_tables else set()\n        if self._ignore_tables:\n            missing_tables = self._ignore_tables - self._all_tables\n            if missing_tables:\n                raise ValueError(\n                    f\"ignore_tables {missing_tables} not found in database\"\n                )\n        usable_tables = self.get_usable_table_names()\n        self._usable_tables = set(usable_tables) if usable_tables else self._all_tables\n\n        if not isinstance(sample_rows_in_table_info, int):\n            raise TypeError(\"sample_rows_in_table_info must be an integer\")\n\n        self._sample_rows_in_table_info = sample_rows_in_table_info\n        self._indexes_in_table_info = indexes_in_table_info\n\n        self._custom_table_info = custom_table_info\n        if self._custom_table_info:\n            if not isinstance(self._custom_table_info, dict):\n                raise TypeError(\n                    \"table_info must be a dictionary with table names as keys and the \"\n                    \"desired table info as values\"\n                )","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/utilities/sql_wrapper.py#L64-L100","documentation":"Mirror of the include_tables check: every name in ignore_tables must exist in the introspected schema (tables, plus views only when view_support=True). Unknown names in the blocklist raise ValueError naming the missing tables, because silently ignoring them would hide configuration mistakes.","triggerScenarios":"SQLDatabase(engine, ignore_tables=['old_audit']) after the table was dropped; ignoring a view without view_support=True; schema-qualified or case-mismatched names that never match introspected names.","commonSituations":"Long-lived apps whose blocklist references tables removed by migrations; porting configs between dev/prod databases with different tables; copying ignore lists written for a different schema.","solutions":["Refresh the blocklist against the live schema: set(insp.get_table_names()) & set(ignore_tables).","Drop names that no longer exist, or regenerate the list from the current database.","Enable view_support=True if the ignored relation is a view."],"exampleFix":"# before\n db = SQLDatabase(engine, ignore_tables=['legacy_logs'])  # table dropped -> ValueError\n\n# after\n from sqlalchemy import inspect\n valid = set(inspect(engine).get_table_names())\n db = SQLDatabase(engine, ignore_tables=list(valid & {'legacy_logs', 'tmp'}))","handlingStrategy":"validation","validationCode":"from sqlalchemy import inspect\n\ndef filter_ignore_tables(engine, ignore_tables, schema=None, view_support=False):\n    insp = inspect(engine)\n    existing = set(insp.get_table_names(schema=schema))\n    if view_support:\n        existing |= set(insp.get_view_names(schema=schema))\n    return list(existing & set(ignore_tables or []))  # drop stale names safely","typeGuard":"def ignore_tables_exist(engine, ignore_tables, schema=None) -> bool:\n    existing = set(inspect(engine).get_table_names(schema=schema))\n    return set(ignore_tables) <= existing","tryCatchPattern":"try:\n    db = SQLDatabase(engine, ignore_tables=tables)\nexcept ValueError as e:\n    if 'ignore_tables' in str(e) and 'not found' in str(e):\n        existing = set(inspect(engine).get_table_names())\n        db = SQLDatabase(engine, ignore_tables=list(existing & set(tables)))\n    else:\n        raise","preventionTips":["Intersect blocklists with live table names at startup to drop stale entries.","Regenerate ignore lists after migrations rename or drop tables.","Enable view_support=True when blocklisting views."],"tags":["sql","schema-validation","text-to-sql","value-error"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}