User Guide & Documentation
F β€” AI Integration
AI Integration

1. Overview

DataKook is fully integrated with Artificial Intelligence and offers a comprehensive suite of AI-powered features designed to transform the way teams interact with their databases. From generating complex SQL queries using plain English to providing an intelligent assistant that optimizes your existing queries, DataKook brings the full power of modern large language models (LLMs) directly into your database workflow.

Security-First Architecture β€” Your Data Stays Protected

The core principle behind DataKook's AI integration is security by design. Unlike traditional approaches where an AI model connects directly to your database β€” exposing connection strings, credentials, and raw data β€” DataKook acts as a secure intermediary bridge between the LLM and your databases.

⚠ Key Security Guarantee: The LLM has no direct access to your databases. There is no connection string, no credential exposure, and no raw data transfer to the AI model. DataKook mediates every interaction, ensuring your data remains protected at all times.

Here is how this architecture works:

  • No connection strings shared with the LLM β€” The AI model never receives or stores any database credentials. All connectivity is managed internally by DataKook's backend.
  • No direct data access β€” The LLM cannot query, read, or modify your database tables directly. It only receives the metadata and context that DataKook explicitly provides in order to generate responses.
  • Schema-aware, data-blind β€” DataKook shares your database schema (table names, column names, data types, and relationships) with the AI model so it can generate accurate SQL. However, the actual row-level data in your tables is never sent to the LLM.
  • Query execution stays on your side β€” When the AI generates a SQL query, it is returned to DataKook and executed by the platform's own database engine using existing secure connections. The LLM is never in the execution path.
  • Audit trail β€” Every AI-generated query is logged and can be reviewed through DataKook's audit capabilities, giving administrators full visibility into what the AI produced and what was actually executed.

This architecture means you benefit from the full power of AI β€” natural language understanding, intelligent query generation, performance optimization suggestions, and more β€” without compromising your organization's security posture, compliance requirements, or data governance policies.

💡 Tip: DataKook ships with a generous allocation of free AI tokens for everyday use. If your team requires higher volumes (e.g., batch processing or automated workflows), you can configure your own API keys under E β€” Settings → 3. AI API Keys.

Supported AI Providers

DataKook supports multiple AI providers, giving you the flexibility to choose the model and infrastructure that best fits your organization:

  • OpenAI β€” Access GPT models directly via your OpenAI API key.
  • Azure OpenAI β€” Use Azure-hosted OpenAI deployments for enterprises that require data residency, private networking, and Azure-managed compliance controls.
  • Additional providers β€” Depending on your DataKook version, further AI providers may be available or added in future releases.

Who Benefits from AI Integration?

DataKook's AI features are designed for every role in your organization:

  • Technical teams (developers, DBAs, data engineers) β€” Accelerate SQL authoring, debug and optimize existing queries, and reduce the time spent on repetitive database tasks.
  • Business users (analysts, managers, product owners) β€” Query databases independently using natural language, generate quick insights, and create charts without writing a single line of SQL or relying on technical teams.
  • Integration architects β€” Expose AI-powered database queries as secure REST APIs, enabling seamless integration with external AI agents, chatbots, and automation workflows.
AI Integration

2.1 Natural Text to SQL

The Natural Text to SQL feature enables technical teams β€” developers, database administrators, and data engineers β€” to generate SQL queries by simply describing what they need in plain English (or any supported language). From simple lookups to complex multi-table joins with aggregations, the AI understands your intent and translates it into accurate, executable SQL.

How It Works

  1. Select your target database β€” Navigate to the database you want to query within the DataKook Database Dashboard.
  2. Enter your request in natural language β€” Type a description of the data you need. For example:
    • "Show me all orders placed in the last 30 days with a total greater than 500"
    • "List the top 10 customers by revenue, grouped by country"
    • "Find all products that have never been ordered"
    • "Calculate the average delivery time per supplier for the last quarter"
  3. Review the generated SQL β€” DataKook displays the AI-generated SQL query before execution. You can inspect, edit, or refine it as needed.
  4. Execute and view results β€” Run the query and see the results rendered in the familiar DataKook table or chart view.

Key Capabilities

  • Simple to complex queries β€” The AI handles everything from basic SELECT statements to advanced queries involving JOIN, GROUP BY, HAVING, subqueries, window functions, common table expressions (CTEs), and more.
  • Schema-aware intelligence β€” The AI is contextually aware of your database schema β€” table names, column names, data types, primary keys, foreign keys, and relationships. This means it generates queries that are structurally correct for your specific database, not generic templates.
  • Multi-dialect support β€” DataKook automatically generates SQL in the appropriate dialect for your connected database engine (SQL Server, PostgreSQL, MySQL, etc.).
  • Iterative refinement β€” If the first result isn't perfect, simply refine your natural language request. The AI learns from the conversation context and progressively improves the output.
Natural Text to SQL β€” Query Generation Interface
💡 Tip: Be as specific as possible in your natural language request. Including table names, date ranges, or column references helps the AI produce more precise SQL on the first attempt. For example, instead of "show sales data", try "show total sales amount per product category for January 2025 from the Orders and Products tables".

Security Context

Remember that the AI only receives your database schema metadata β€” it never sees the actual data stored in your tables. The generated SQL query is executed by DataKook's backend using the existing secure database connection, and results are displayed only to the authorized user who initiated the request.

AI Integration

2.2 AI Assistant

The AI Assistant is an intelligent companion that helps you work with existing SQL queries. Whether you have a query that returns incorrect results, runs too slowly, or is difficult to understand, the AI Assistant can analyze it, suggest corrections, and recommend performance improvements β€” all within the DataKook interface.

What the AI Assistant Can Do

  • Correct SQL errors β€” Paste or select a query that throws errors, and the AI Assistant will identify syntax mistakes, missing joins, incorrect column references, or logical issues and provide a corrected version with an explanation of what was wrong.
  • Optimize query performance β€” Submit a slow-running query, and the AI will analyze it against your database schema to suggest optimizations such as:
    • Rewriting subqueries as JOIN operations
    • Adding or leveraging existing indexes
    • Removing unnecessary columns from SELECT clauses
    • Replacing correlated subqueries with window functions or CTEs
    • Optimizing WHERE clause predicates for better index utilization
  • Explain complex queries β€” If you encounter a complex SQL statement (e.g., inherited from a legacy system or written by another team), the AI Assistant can break it down into plain language, explaining each clause, join, and filter step by step.
  • Refactor and modernize β€” The assistant can suggest modern SQL patterns to replace outdated syntax, improve readability, and align queries with current best practices for your specific database engine.

How to Use It

  1. Open the SQL Query editor in the Database Dashboard.
  2. Write or paste the SQL query you want to improve.
  3. Activate the AI Assistant and describe what you need β€” for example: "This query is slow, please optimize it" or "Fix the syntax error in this query" or "Explain what this query does".
  4. Review the AI's suggestions, apply the changes, and execute the improved query.
AI Assistant β€” Query Optimization Interface
💡 Tip: Combine the AI Assistant with DataKook's audit features to compare query execution times before and after optimization. This provides concrete evidence of the performance gains achieved through AI-suggested improvements.
AI Integration

2.3 AI REST APIs

AI REST APIs allow you to query your databases using natural language through secure, authenticated REST API endpoints. This feature extends DataKook's AI capabilities beyond the web interface, making it possible to integrate AI-powered database access into external applications, AI agents, chatbots, automation pipelines, and any system that can make HTTP requests.

How It Works

DataKook exposes dedicated API endpoints that accept natural language queries as input. The platform translates the text into the appropriate SQL query using the same AI engine that powers the in-app Natural Text to SQL feature, executes it securely against your database, and returns the results as structured JSON data.

  1. Authenticate β€” Call the DataKook authentication endpoint to obtain a valid access token (OAuth2 or external authentication, depending on your configuration).
  2. Send a natural language query β€” Make a POST request to the AI REST API endpoint, including your natural language question in the request body along with the target database identifier.
  3. Receive structured results β€” The API returns the query results as JSON, ready to be consumed by your application, dashboard, or AI workflow.

Key Use Cases

  • AI Agent Integration β€” Connect your AI agents (built with LangChain, Semantic Kernel, AutoGen, or any framework) to DataKook's AI REST APIs. Your agents can query multiple databases using natural language without needing direct database access, connection strings, or SQL knowledge. DataKook handles all the translation, execution, and security.
  • Chatbot & Conversational Interfaces β€” Build chatbots that answer business questions in real time by fetching live data from your databases through DataKook. Users interact with the chatbot in natural language, and the bot uses the AI REST API to retrieve accurate, up-to-date answers.
  • Automation & Workflow Pipelines β€” Integrate AI-driven database queries into tools like Power Automate, Logic Apps, n8n, or custom scripts. For example, automatically generate a daily summary report by sending a natural language request to DataKook's API every morning.
  • Multi-Database Queries β€” Query different databases from a single integration point. The AI REST API supports targeting any database connected to DataKook, making it a unified data access layer for diverse data sources.

Security & Access Control

All AI REST API requests are subject to the same security model as the DataKook platform:

  • Every request must include a valid authentication token.
  • API access respects the user's role and permissions β€” users can only query databases they are authorized to access.
  • The LLM never receives database credentials or raw data; it only processes the schema metadata needed to generate SQL.
  • All API calls are logged and auditable.
AI REST APIs β€” Natural Language Query Endpoint AI REST APIs β€” JSON Response
💡 Tip: When integrating with external AI agents, use the AI REST API together with DataKook's OAuth2 authentication to ensure that each agent session is scoped to the correct user permissions. This prevents unauthorized data access even if the agent is shared across teams. See C β€” REST APIs → 1.3 OAuth2 Authentication for setup details.
AI Integration

2.4 Business Users

One of DataKook's most powerful AI capabilities is enabling business users β€” analysts, managers, product owners, and other non-technical stakeholders β€” to query databases independently, without writing SQL and without relying on technical teams. Using natural language, business users can ask questions about their data and receive instant answers, insights, and visualizations.

Why This Matters

In most organizations, accessing database information requires filing a request with a developer or data engineer, waiting for the query to be written and executed, and then interpreting the raw results. This cycle can take hours or even days, creating bottlenecks and slowing down decision-making.

With DataKook's AI integration, business users can bypass this bottleneck entirely:

  • Ask in plain language β€” No SQL syntax, no technical jargon. Just type a question like "What were our top 5 selling products last month?" or "How many new customers signed up this week compared to last week?"
  • Get instant answers β€” The AI translates the question into SQL, DataKook executes it securely, and the results appear within seconds.
  • Create charts and visualizations β€” Turn query results into bar charts, line graphs, pie charts, and other visual formats with a single click. Perfect for quick presentations, stakeholder meetings, or ad-hoc reporting.
  • Iterate and explore β€” Refine your question, drill down into specific segments, or ask follow-up questions. The AI maintains conversational context so each subsequent query builds on the previous one.

Typical Use Cases

  • Quick business insights β€” Get real-time answers to ad-hoc questions without waiting for a report to be built.
  • KPI monitoring β€” Check key performance indicators on demand: revenue, conversion rates, customer counts, inventory levels, and more.
  • Data exploration β€” Discover trends, anomalies, and patterns in your data through iterative natural language queries.
  • Meeting preparation β€” Generate up-to-date data summaries and charts minutes before a meeting, ensuring decisions are based on the latest information.
  • Self-service reporting β€” Reduce the backlog on technical teams by empowering business users to answer their own data questions.

Access Control for Business Users

DataKook ensures that business users can only access databases and tables they have been granted permission to use. The AI feature respects the platform's existing role-based access controls, so there is no risk of unauthorized data exposure. Administrators can configure exactly which databases are available to which users through the A β€” General → 2. User Management settings.

Business Users β€” Natural Language Query and Chart View
💡 Tip: Encourage business users to start with simple questions and progressively ask more complex ones. The AI is designed to handle both, but starting simple helps users build confidence and understand how the natural language interface interprets their intent.