Forum Discussion

PradyumnaSh123's avatar
PradyumnaSh123
Regular Visitor
1 month ago
Solved

How would you architect an enterprise RAG + Text-to-SQL solution using Microsoft Fabric?

Hi everyone Fabric 

I'm currently working as an AI Intern on an enterprise application that combines Retrieval-Augmented Generation (RAG) with Natural Language to SQL (Text-to-SQL) to allow users to query both documents and relational databases using natural language.

Our current technology stack includes:

  • Azure OpenAI
  • PostgreSQL
  • ChromaDB (Vector Database)
  • FastAPI
  • Python

Our current workflow is:

User Query → AI Router → Document RAG or Text-to-SQL → Azure OpenAI → PostgreSQL / Vector Database → Final Response

As I begin learning Microsoft Fabric, I'm trying to understand how experienced data engineers and AI engineers would design this type of architecture using Fabric services.

I would really appreciate your thoughts on the following questions:

  1. Where would Microsoft Fabric fit naturally into this architecture?
  2. Would you recommend using a Lakehouse, Warehouse, or both for enterprise AI applications?
  3. Would Fabric replace PostgreSQL, or would it typically complement an existing relational database?
  4. How would you design the document ingestion and transformation pipeline before generating embeddings?
  5. Which Fabric services would you use for orchestration, storage, analytics, and AI workloads?
  6. Are there any reference architectures or real-world implementations that you would recommend studying?

My goal is to understand how organizations are using Microsoft Fabric together with Azure OpenAI to build scalable enterprise AI solutions rather than just proof-of-concept projects.

I'd greatly appreciate any architectural advice, recommended resources, or lessons learned from your own experience.

Thank you!

  • Hi Pradyumna,

    Your existing router-based design is a good foundation. I would use Microsoft Fabric mainly as the governed data, transformation, analytics, and orchestration layer rather than replacing every component of the application.

    A possible enterprise architecture could be:

    User/Application → FastAPI or Agent Router → Document RAG / Structured-Data Agent → Azure OpenAI → Final Answer

    On the Fabric side:

    1. Document ingestion and preparation

    Use Fabric Data Factory pipelines to ingest documents from SharePoint, Blob Storage, APIs, or databases into OneLake. Store raw documents in a Lakehouse, then use Fabric notebooks or Spark jobs for:

    Text extraction and cleaning
    Metadata enrichment
    Document classification
    Chunking
    Duplicate removal
    Embedding generation

    Microsoft’s Fabric RAG guidance demonstrates storing content in a Lakehouse, processing and chunking it with Spark, generating embeddings through Azure OpenAI/SynapseML, and using Azure AI Search as the vector index.

    2. Vector retrieval

    For production RAG, I would generally use Azure AI Search rather than treating the Lakehouse itself as the vector-serving layer. Azure AI Search supports vector and hybrid retrieval, filtering, ranking, and RAG-oriented retrieval patterns. A OneLake indexer can also index Lakehouse files, detect updated content, and perform integrated chunking and vectorization.

    3. Structured-data querying

    Use a Fabric Warehouse when the data is curated, relational, and intended for governed BI or SQL analytics. Use the Lakehouse for raw, semi-structured, historical, or data-science-oriented data. In many enterprise solutions, both are useful:

    Lakehouse: raw and transformed documents, logs, ML datasets and Delta tables
    Warehouse: curated dimensions, facts, business rules and SQL-facing datasets

    Fabric Data Agents are especially relevant here. They can route natural-language questions to Lakehouses, Warehouses, Power BI semantic models, KQL databases and other supported sources. For SQL sources, the agent generates, validates and runs read-only T-SQL through the SQL analytics endpoint.

    4. PostgreSQL

    I would not automatically replace PostgreSQL. Keep it when it serves operational transactions, application state, low-latency CRUD operations or existing business services. Fabric would normally complement it by ingesting or mirroring operational data for analytics and AI.

    Replacing PostgreSQL could make sense only when its workload fits Fabric SQL Database or Warehouse requirements. Fabric SQL Database now supports AI application patterns involving Azure OpenAI, vector embeddings and RAG, but the choice should be based on transactional requirements rather than platform consolidation alone.

    5. Orchestration and governance

    I would use:

    Data Factory pipelines for ingestion and scheduling
    Lakehouse and OneLake for document and analytical storage
    Notebooks/Spark for chunking, preprocessing and embeddings
    Warehouse or Fabric SQL Database for structured data
    Azure AI Search for production document retrieval
    Fabric Data Agent for governed natural-language access to structured data
    Azure OpenAI for routing, generation and response synthesis
    Power BI for evaluation and operational monitoring

    One important design principle is to keep the router outside the retrieval systems. It should classify the request as document-only, SQL-only, or hybrid. For hybrid questions, retrieve both document evidence and structured results, then ask the model to generate one answer with source citations.

    For enterprise readiness, I would also add:

    Microsoft Entra ID authentication
    User-level authorization before retrieval
    Row-level and object-level security
    Prompt and query logging
    SQL allow-lists and read-only execution
    Retrieval and Text-to-SQL evaluation datasets
    Citation validation
    Cost, latency and token monitoring

    Your current FastAPI layer can remain the application-facing API while Fabric becomes the governed data and analytics foundation. I would begin with a small hybrid implementation: Lakehouse + Azure AI Search for documents, Warehouse/Data Agent for structured questions, and Azure OpenAI as the final response layer.

  • Hi User,

    This is a great enterprise architecture question. One approach I've seen work well is to let Microsoft Fabric complement Azure AI services rather than replace them.

    A typical architecture could look like this:

    • Use a Lakehouse as the central storage layer for raw and curated documents (PDFs, Word files, JSON, etc.).

    • Use Data Factory Pipelines or Dataflows Gen2 to ingest and transform data before generating embeddings.

    • Perform document preprocessing and embedding generation in Fabric Data Science (Spark Notebooks) or Azure AI, then store embeddings in your preferred vector database (or another supported vector store).

    • Use a Warehouse for structured business data and analytical SQL workloads, while keeping operational databases such as PostgreSQL if they're already part of your application.

    • Use OneLake as the unified data layer so both structured and unstructured data are governed in a single platform.

    • Orchestrate ingestion, model execution, and refreshes using Fabric Data Factory.

    • Continue using Azure OpenAI for LLM inference, routing, and Text-to-SQL generation, with Fabric providing the governed data platform behind it.

    Regarding your questions:

    • Lakehouse is generally preferred for unstructured documents and feature engineering, while Warehouse is ideal for curated relational data and analytics. Many enterprise solutions use both together.

    • Fabric doesn't necessarily replace PostgreSQL. PostgreSQL often remains the operational database, while Fabric serves as the analytical and AI data platform.

    • For RAG, a common pattern is: Ingest → Clean → Chunk → Generate embeddings → Store embeddings → Retrieve relevant context → Azure OpenAI generates the response.

    • Fabric excels at data engineering, governance, orchestration, and analytics, while Azure AI services handle LLMs, embeddings, and AI inferencing.

    For more information:

    Could you also clarify:

    • Is your goal to build a production enterprise solution or primarily a proof of concept?

    • Will your Text-to-SQL target only PostgreSQL, or do you expect to query Fabric Warehouses/Lakehouses as well?

    • Are you planning to keep ChromaDB, or are you evaluating alternative vector s

      torage options within the Microsoft ecosystem?

    I'd also be interested to hear how others are combining Microsoft Fabric with Azure OpenAI for enterprise-scale RAG and Text-to-SQL implementations, especially around governance, MLOps, and multi-agent architectures.

     

    💡 Helpful? Give a Kudos 👍 — keep the community growing.

    Solved your issue? Mark this as the Accepted Solution ✔️

    Best regards,
    Prince Singh | Data Science & Microsoft Fabric Enthusiast

     

5 Replies

  • Hi User,

    This is a great enterprise architecture question. One approach I've seen work well is to let Microsoft Fabric complement Azure AI services rather than replace them.

    A typical architecture could look like this:

    • Use a Lakehouse as the central storage layer for raw and curated documents (PDFs, Word files, JSON, etc.).

    • Use Data Factory Pipelines or Dataflows Gen2 to ingest and transform data before generating embeddings.

    • Perform document preprocessing and embedding generation in Fabric Data Science (Spark Notebooks) or Azure AI, then store embeddings in your preferred vector database (or another supported vector store).

    • Use a Warehouse for structured business data and analytical SQL workloads, while keeping operational databases such as PostgreSQL if they're already part of your application.

    • Use OneLake as the unified data layer so both structured and unstructured data are governed in a single platform.

    • Orchestrate ingestion, model execution, and refreshes using Fabric Data Factory.

    • Continue using Azure OpenAI for LLM inference, routing, and Text-to-SQL generation, with Fabric providing the governed data platform behind it.

    Regarding your questions:

    • Lakehouse is generally preferred for unstructured documents and feature engineering, while Warehouse is ideal for curated relational data and analytics. Many enterprise solutions use both together.

    • Fabric doesn't necessarily replace PostgreSQL. PostgreSQL often remains the operational database, while Fabric serves as the analytical and AI data platform.

    • For RAG, a common pattern is: Ingest → Clean → Chunk → Generate embeddings → Store embeddings → Retrieve relevant context → Azure OpenAI generates the response.

    • Fabric excels at data engineering, governance, orchestration, and analytics, while Azure AI services handle LLMs, embeddings, and AI inferencing.

    For more information:

    Could you also clarify:

    • Is your goal to build a production enterprise solution or primarily a proof of concept?

    • Will your Text-to-SQL target only PostgreSQL, or do you expect to query Fabric Warehouses/Lakehouses as well?

    • Are you planning to keep ChromaDB, or are you evaluating alternative vector s

      torage options within the Microsoft ecosystem?

    I'd also be interested to hear how others are combining Microsoft Fabric with Azure OpenAI for enterprise-scale RAG and Text-to-SQL implementations, especially around governance, MLOps, and multi-agent architectures.

     

    💡 Helpful? Give a Kudos 👍 — keep the community growing.

    Solved your issue? Mark this as the Accepted Solution ✔️

    Best regards,
    Prince Singh | Data Science & Microsoft Fabric Enthusiast

     

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Thankyou Prince0011 , binitafulpagare  ,  for Addressing the issue.


    Hi   PradyumnaSh123  , 

    Thank you for reaching out to Microsoft Fabric Community Forum,

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?


    Regards,

    Chaithanya

    • binitafulpagare's avatar
      binitafulpagare
      Kudo Collector

      Thank you, v-kathullac. I'm glad I could contribute to the discussion. I appreciate the support from the Microsoft Fabric Community and look forward to continuing to learn and contribute.

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Thankyou @Prince0011 , @binitafulpagare ,  for Addressing the issue.


    Hi  @PradyumnaSh123  , 

    Thank you for reaching out to Microsoft Fabric Community Forum,

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?


    Regards,

    Chaithanya

  • Hi Pradyumna,

    Your existing router-based design is a good foundation. I would use Microsoft Fabric mainly as the governed data, transformation, analytics, and orchestration layer rather than replacing every component of the application.

    A possible enterprise architecture could be:

    User/Application → FastAPI or Agent Router → Document RAG / Structured-Data Agent → Azure OpenAI → Final Answer

    On the Fabric side:

    1. Document ingestion and preparation

    Use Fabric Data Factory pipelines to ingest documents from SharePoint, Blob Storage, APIs, or databases into OneLake. Store raw documents in a Lakehouse, then use Fabric notebooks or Spark jobs for:

    Text extraction and cleaning
    Metadata enrichment
    Document classification
    Chunking
    Duplicate removal
    Embedding generation

    Microsoft’s Fabric RAG guidance demonstrates storing content in a Lakehouse, processing and chunking it with Spark, generating embeddings through Azure OpenAI/SynapseML, and using Azure AI Search as the vector index.

    2. Vector retrieval

    For production RAG, I would generally use Azure AI Search rather than treating the Lakehouse itself as the vector-serving layer. Azure AI Search supports vector and hybrid retrieval, filtering, ranking, and RAG-oriented retrieval patterns. A OneLake indexer can also index Lakehouse files, detect updated content, and perform integrated chunking and vectorization.

    3. Structured-data querying

    Use a Fabric Warehouse when the data is curated, relational, and intended for governed BI or SQL analytics. Use the Lakehouse for raw, semi-structured, historical, or data-science-oriented data. In many enterprise solutions, both are useful:

    Lakehouse: raw and transformed documents, logs, ML datasets and Delta tables
    Warehouse: curated dimensions, facts, business rules and SQL-facing datasets

    Fabric Data Agents are especially relevant here. They can route natural-language questions to Lakehouses, Warehouses, Power BI semantic models, KQL databases and other supported sources. For SQL sources, the agent generates, validates and runs read-only T-SQL through the SQL analytics endpoint.

    4. PostgreSQL

    I would not automatically replace PostgreSQL. Keep it when it serves operational transactions, application state, low-latency CRUD operations or existing business services. Fabric would normally complement it by ingesting or mirroring operational data for analytics and AI.

    Replacing PostgreSQL could make sense only when its workload fits Fabric SQL Database or Warehouse requirements. Fabric SQL Database now supports AI application patterns involving Azure OpenAI, vector embeddings and RAG, but the choice should be based on transactional requirements rather than platform consolidation alone.

    5. Orchestration and governance

    I would use:

    Data Factory pipelines for ingestion and scheduling
    Lakehouse and OneLake for document and analytical storage
    Notebooks/Spark for chunking, preprocessing and embeddings
    Warehouse or Fabric SQL Database for structured data
    Azure AI Search for production document retrieval
    Fabric Data Agent for governed natural-language access to structured data
    Azure OpenAI for routing, generation and response synthesis
    Power BI for evaluation and operational monitoring

    One important design principle is to keep the router outside the retrieval systems. It should classify the request as document-only, SQL-only, or hybrid. For hybrid questions, retrieve both document evidence and structured results, then ask the model to generate one answer with source citations.

    For enterprise readiness, I would also add:

    Microsoft Entra ID authentication
    User-level authorization before retrieval
    Row-level and object-level security
    Prompt and query logging
    SQL allow-lists and read-only execution
    Retrieval and Text-to-SQL evaluation datasets
    Citation validation
    Cost, latency and token monitoring

    Your current FastAPI layer can remain the application-facing API while Fabric becomes the governed data and analytics foundation. I would begin with a small hybrid implementation: Lakehouse + Azure AI Search for documents, Warehouse/Data Agent for structured questions, and Azure OpenAI as the final response layer.