{"record":{"id":"54ee7f709f660e1b","repo":"getredash/redash","slug":"failed-getting-schema-54ee7f","errorCode":null,"errorMessage":"Failed getting schema.","messagePattern":"Failed getting schema\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"redash/query_runner/sqlite.py","lineNumber":40,"sourceCode":"        }\n\n    @classmethod\n    def type(cls):\n        return \"sqlite\"\n\n    def __init__(self, configuration):\n        super(Sqlite, self).__init__(configuration)\n\n        self._dbpath = self.configuration.get(\"dbpath\", \"\")\n\n    def _get_tables(self, schema):\n        query_table = \"select tbl_name from sqlite_master where type='table'\"\n        query_columns = 'PRAGMA table_info(\"%s\")'\n\n        results, error = self.run_query(query_table, None)\n\n        if error is not None:\n            raise Exception(\"Failed getting schema.\")\n\n        for row in results[\"rows\"]:\n            table_name = row[\"tbl_name\"]\n            schema[table_name] = {\"name\": table_name, \"columns\": []}\n            results_table, error = self.run_query(query_columns % (table_name,), None)\n            if error is not None:\n                self._handle_run_query_error(error)\n\n            for row_column in results_table[\"rows\"]:\n                schema[table_name][\"columns\"].append(row_column[\"name\"])\n\n        return list(schema.values())\n\n    def run_query(self, query, user):\n        connection = sqlite3.connect(self._dbpath)\n\n        cursor = connection.cursor()\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/sqlite.py#L22-L58","documentation":"Raised by Sqlite._get_tables (redash/query_runner/sqlite.py:40) when querying sqlite_master for the table list returns a non-None error. It fires while building the schema for the schema browser; the underlying run_query failure (unreadable/corrupt database file, locked database, permissions) is the actual cause but is discarded.","triggerScenarios":"Opening the schema dialog for a SQLite data source whose file path is unreadable, is locked by another writer, or is not a valid SQLite database; also when the configured file lives on a path the Redash worker cannot access.","commonSituations":"Wrong file path in the data source config (relative vs absolute); database file on a mount not visible to the worker container; file created by a newer/incompatible SQLite page format or corrupt; concurrent writer holding an exclusive lock.","solutions":["Verify the database path is absolute and readable by the Redash worker user (test with `ls -l` and `sqlite3 <db> '.tables'` inside the worker container)","If the file is locked, stop the writing process or enable WAL / busy_timeout on the writer","If the file is corrupt or empty, restore from a backup or recreate it before refreshing the schema"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os, sqlite3\nif not os.path.isfile(db_path) or not os.access(db_path, os.R_OK):\n    raise ValueError('sqlite db missing/unreadable: {}'.format(db_path))\nconn = sqlite3.connect(db_path); conn.close()","typeGuard":null,"tryCatchPattern":"try:\n    tables = ds.query_runner.get_schema()\nexcept Exception as e:\n    logger.warning('sqlite schema failed: %s', e)\n    tables = []","preventionTips":["Use absolute database paths visible to the worker container","Enable WAL mode and set busy_timeout on writers to avoid lock failures","Health-check the sqlite file (open/close) in the data source save handler"],"tags":["sqlite","redash","schema","introspection"],"backgroundTag":"schema-introspection-failed","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}