{
  "schema_version": "1.0",
  "publisher": "AI Release",
  "article": {
    "title": "How to restrict LLM access to database tables in Text-to-SQL: schema filtering, roles and permissions",
    "canonical_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
    "language": "en",
    "article_type": "guide",
    "published_at": null,
    "updated_at": "2026-12-02T00:00:00+00:00"
  },
  "summary": "Time to complete: 45 minutes Difficulty: Intermediate",
  "topics": [
    "text-to-sql",
    "доступ LLM к базе данных",
    "schema filtering",
    "права доступа SQL для ИИ",
    "безопасность text-to-sql"
  ],
  "entities": [
    {
      "id": "E1",
      "name": "text-to-sql",
      "type": "тема/инструмент",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E2",
      "name": "доступ LLM к базе данных",
      "type": "тема/инструмент",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E3",
      "name": "schema filtering",
      "type": "тема/инструмент",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E4",
      "name": "права доступа SQL для ИИ",
      "type": "тема/инструмент",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E5",
      "name": "безопасность text-to-sql",
      "type": "тема/инструмент",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E6",
      "name": "Windows",
      "type": "платформа/технология",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E7",
      "name": "Linux",
      "type": "платформа/технология",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    },
    {
      "id": "E8",
      "name": "macOS",
      "type": "платформа/технология",
      "description": "упоминается в заголовке, TL;DR или разделах гайда",
      "url": null
    }
  ],
  "claims": [
    {
      "id": "AR-GUIDE-KAKOGRANIC-001",
      "statement": "Time to complete: 45 minutes",
      "claim_type": "guide_fact",
      "confidence": "not_assessed",
      "source_type": "заявление источника",
      "verification_status": "reported_unverified",
      "source_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
      "article_anchor": "#tldr",
      "evidence_excerpt": "Time to complete: 45 minutes"
    },
    {
      "id": "AR-GUIDE-KAKOGRANIC-002",
      "statement": "Difficulty: Intermediate",
      "claim_type": "guide_fact",
      "confidence": "not_assessed",
      "source_type": "заявление источника",
      "verification_status": "reported_unverified",
      "source_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
      "article_anchor": "#tldr",
      "evidence_excerpt": "Difficulty: Intermediate"
    },
    {
      "id": "AR-GUIDE-KAKOGRANIC-003",
      "statement": "You need: PostgreSQL with psql client access (version — check the documentation for your build), an admin role with CREATEROLE and GRANT rights, and a Text-to-SQL service where you can change the database connection string (DSN).",
      "claim_type": "guide_fact",
      "confidence": "not_assessed",
      "source_type": "заявление источника",
      "verification_status": "reported_unverified",
      "source_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
      "article_anchor": "#tldr",
      "evidence_excerpt": "You need: PostgreSQL with psql client access (version — check the documentation for your build), an admin role with CREATEROLE and GRANT rights, and a Text-to-SQL service where you can change the database connection string (DSN)."
    },
    {
      "id": "AR-GUIDE-KAKOGRANIC-004",
      "statement": "Linux or macOS shell with psql on PATH; on Windows use the same commands inside WSL or psql.exe from the PostgreSQL client package.",
      "claim_type": "guide_fact",
      "confidence": "not_assessed",
      "source_type": "заявление источника",
      "verification_status": "reported_unverified",
      "source_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
      "article_anchor": "#requirements",
      "evidence_excerpt": "Linux or macOS shell with psql on PATH; on Windows use the same commands inside WSL or psql.exe from the PostgreSQL client package."
    },
    {
      "id": "AR-GUIDE-KAKOGRANIC-005",
      "statement": "Admin access to the target database (<admin_user>), because creating roles and revoking schema privileges requires ownership or superuser rights.",
      "claim_type": "guide_fact",
      "confidence": "not_assessed",
      "source_type": "заявление источника",
      "verification_status": "reported_unverified",
      "source_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
      "article_anchor": "#requirements",
      "evidence_excerpt": "Admin access to the target database (<admin_user>), because creating roles and revoking schema privileges requires ownership or superuser rights."
    },
    {
      "id": "AR-GUIDE-KAKOGRANIC-006",
      "statement": "A TEXT-to-SQL service (agent or chatbot) whose DSN you can edit — the connection string is the only place the model gets its credentials.",
      "claim_type": "guide_fact",
      "confidence": "not_assessed",
      "source_type": "заявление источника",
      "verification_status": "reported_unverified",
      "source_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
      "article_anchor": "#requirements",
      "evidence_excerpt": "A TEXT-to-SQL service (agent or chatbot) whose DSN you can edit — the connection string is the only place the model gets its credentials."
    }
  ],
  "relationships": [
    {
      "subject": "Guide",
      "predicate": "describes",
      "object": "How to restrict LLM access to database tables in Text-to-SQL: schema filtering, roles and permissions",
      "claim_id": "AR-GUIDE-KAKOGRANIC-001"
    },
    {
      "subject": "Guide",
      "predicate": "includes step",
      "object": "Step 1. Create the restricted login role",
      "claim_id": "AR-GUIDE-KAKOGRANIC-001"
    }
  ],
  "questions_and_answers": [
    {
      "question": "What is required?",
      "answer": "Linux or macOS shell with psql on PATH; on Windows use the same commands inside WSL or psql.exe from the PostgreSQL client package.; Admin access to the target database (<admin_user>), because creating roles and revoking schema privileges requires ownership or superuser rights.; A TEXT-to-SQL service (agent or…",
      "claim_ids": [
        "AR-GUIDE-KAKOGRANIC-003"
      ],
      "article_anchor": "#requirements"
    },
    {
      "question": "How to do it?",
      "answer": "Step 1. Create the restricted login role → Step 2. Build a read-only schema layer and grant least privilege → Step 3. Run negative and positive tests",
      "claim_ids": [
        "AR-GUIDE-KAKOGRANIC-004"
      ],
      "article_anchor": "#step-1"
    },
    {
      "question": "Which topics does it cover?",
      "answer": "text-to-sql, доступ LLM к базе данных, schema filtering, права доступа SQL для ИИ, безопасность text-to-sql",
      "claim_ids": [
        "AR-GUIDE-KAKOGRANIC-002"
      ],
      "article_anchor": "#entities"
    },
    {
      "question": "What are the key points?",
      "answer": "Time to complete: 45 minutes Difficulty: Intermediate",
      "claim_ids": [
        "AR-GUIDE-KAKOGRANIC-007"
      ],
      "article_anchor": "#tldr"
    }
  ],
  "limitations": [
    "Current versions, prices and limits.",
    "Independent benchmarks and quality checks.",
    "Terms of use and data policy."
  ],
  "citation": {
    "preferred_citation": "AI Release. Как ограничить доступ LLM к базе данных при Text-to-SQL: настройка схемы, ролей и прав. https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
    "canonical_url": "https://ai-release.org/guides/kak-ogranichit-dostup-llm-k-baze-dannyh-pri-text-to-sql_en.html",
    "publisher": "AI Release"
  }
}