{"record":{"id":"0542fa95f195fbfa","repo":"zylon-ai/private-gpt","slug":"database-query-dependencies-are-not-installed-ins","errorCode":null,"errorMessage":"Database query dependencies are not installed. Install with one of: `uv sync --inexact --extra database-postgres` or `uv sync --inexact --extra database-mysql` or `uv sync --inexact --extra database-mssql` or `uv sync --inexact --extra database-db2` or `uv sync --inexact --extra database`.","messagePattern":"Database query dependencies are not installed\\. Install with one of: `uv sync --inexact --extra database-postgres` or `uv sync --inexact --extra database-mysql` or `uv sync --inexact --extra database-mssql` or `uv sync --inexact --extra database-db2` or `uv sync --inexact --extra database`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/tabular/database_query_generator.py","lineNumber":68,"sourceCode":"from private_gpt.di import get_global_injector\nfrom private_gpt.events.models import TextBlock\nfrom private_gpt.utils.dependencies import format_missing_dependency_message\n\nif TYPE_CHECKING:\n    from sqlalchemy import Row\n\nlogger = logging.getLogger(__name__)\n\ntry:\n    import sqlglot  # type: ignore[import-not-found]  # ty:ignore[unresolved-import]\n    from sqlglot import (  # ty:ignore[unresolved-import]\n        Dialects,  # type: ignore[import-not-found]\n    )\n    from sqlglot.errors import (  # ty:ignore[unresolved-import]\n        ParseError,  # type: ignore[import-not-found]\n    )\nexcept (ImportError, ModuleNotFoundError) as e:\n    raise ImportError(\n        format_missing_dependency_message(\n            \"Database query\",\n            extras=(\n                \"database-postgres\",\n                \"database-mysql\",\n                \"database-mssql\",\n                \"database-db2\",\n                \"database\",\n            ),\n        )\n    ) from e\n\n\n@functools.cache\ndef _load_ibm_db() -> Any:\n    try:\n        import ibm_db  # type: ignore[import-not-found]  # ty:ignore[unresolved-import]\n    except ImportError as e:","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tabular/database_query_generator.py#L50-L86","documentation":"Raised at module import time of database_query_generator.py when the sqlglot package cannot be imported. sqlglot powers SQL parsing/transpilation and is optional, distributed via the database extras (postgres/mysql/mssql/db2 or the umbrella 'database' extra). Because it fails at import, the error surfaces as soon as the tabular/database-query module is loaded, with the exact uv sync commands listed in the message.","triggerScenarios":"Importing private_gpt.components.tabular.database_query_generator (directly or via enabling database-query features) in an environment where sqlglot is not installed.","commonSituations":"Enabling the tabular/database query feature on a deployment installed without any database extra; CI or Docker images built from a minimal dependency set; local venv synced before the feature was toggled on.","solutions":["Install one extra matching your DB: uv sync --inexact --extra database-postgres (or database-mysql / database-mssql / database-db2), or the umbrella: uv sync --inexact --extra database","Verify: python -c \"import sqlglot\"","If you do not need database queries, disable the feature so the module is never imported"],"exampleFix":"# terminal — before: import fails with ImportError\nuv sync --inexact --extra database-postgres\n# after: import private_gpt.components.tabular.database_query_generator works","handlingStrategy":"validation","validationCode":"try:\n    import sqlglot  # noqa: F401\nexcept ImportError:\n    raise SystemExit(\n        \"database query requires sqlglot: \"\n        \"uv sync --inexact --extra database-postgres\"\n    )\nfrom private_gpt.components.tabular.database_query_generator import (  # noqa: F401\n    DatabaseQueryGenerator,\n)","typeGuard":"def database_query_available() -> bool:\n    try:\n        import sqlglot  # noqa: F401\n        return True\n    except ImportError:\n        return False","tryCatchPattern":null,"preventionTips":["Import the tabular module lazily and guard with importlib.util.find_spec('sqlglot')","Install at least one database extra in every environment that enables the feature"],"tags":["database","dependencies","import","installation","sqlglot"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}